1

I want to use .htaccess mod_rewrite to remove .php from all my files and force a trailing slash /. However, it is only resulting in me getting server errors.

1

1 Answer 1

2

You want to map :

http://sampledomain.ext/index/ -> http://sampledomain.ext/index.html

Use the following .htaccess

 RewriteEngine On
 RewriteCond %{REQUEST_URI} ! \.php$ #Avoid real php page, do what you want with them
 RewriteCond %{REQUEST_URI} /$       #Ensure a final slash
 RewriteRule ^(.*)$ $1.php           #Add your extension

Tx to David Wolever who write quitely the same stuff 1

If I can give my opinion, it's a little bit strange to force the / at the end for a file no?

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.