0

Hi guys I am using this and I know the htaccess is working because it is redirecting to notfound.php but for some reason I can't get it to work to not show extensions (php/html) any help here?

<Files ~ "^\.(htaccess|htpasswd)$"> deny from all </Files> Options Indexes ErrorDocument 404 notfound.php RewriteEngine on RewriteCond %{HTTP_HOST} ^(www\.socialscenes\.co\.uk)(:80)? [NC] RewriteRule ^(.*) http://socialscenes.co.uk/$1 [R=301,L] DirectoryIndex index.php order deny,allow 

1 Answer 1

1

Well you will need much more than what you have to support hiding .php and .html extensions. Consider this code:

Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory:

Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / ## hide .php or .html extension # To externally redirect foo.php ot foo.html to foo RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s([^.]+)\.(php|html) [NC] RewriteRule ^ %1 [R,L,NC] ## To internally redirect /dir/foo to /dir/foo.html RewriteCond %{REQUEST_FILENAME}.html -f RewriteRule ^ %{REQUEST_URI}.html [L] ## To internally redirect /dir/foo to /dir/foo.php RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^ %{REQUEST_URI}.php [L] 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.