开发者

.htaccess rewrite question

开发者 https://www.devze.com 2023-01-23 14:27 出处:网络
How would I change http://website.com/file.php to http://开发者_开发技巧website.com/file/ thanks.In most apache server deployments, you can create a .htaccess on the document root containing:

How would I change

http://website.com/file.php

to

http://开发者_开发技巧website.com/file/

thanks.


In most apache server deployments, you can create a .htaccess on the document root containing:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1.php

This will work as long as "file" does not match any existing directory.

0

精彩评论

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