开发者

Remove .php from URL and force a trailing slash /

I want to us开发者_如何学Ce .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.


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?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜