Wexo
Wexo

Reputation: 175

htaccess not rewriting really well with hiding extension

So I am basically facing this problem with Rewrite. How?

So am trying to hide the:

example.php to /example 

I got that working but now am facing another problem with other extensions. Thy is it rewriting?

WebPlayer.unity3d to WebPlayer.unity3d/

The / at the end I need that removed.

Any help is greatly appreciated. Thank You!

Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]

Upvotes: 2

Views: 39

Answers (2)

Amit Verma
Amit Verma

Reputation: 41219

Turn off -Multiviews

Try:

Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^.]+)$ $1.php [NC,L]

Upvotes: 1

arodebaugh
arodebaugh

Reputation: 538

So your .htaccess code looks right to me. What you could try is make a separate .htaccess for the folder WebPlayer.unity3d that does not have the conflicting code.

Good Luck!

Upvotes: 2

Related Questions