我想通过htaccess文件从url中删除.php . 例如 home.php 到 home 我在htaccess文件中使用了以下重写规则 .
RewriteRule ^(([^/]+/)*[^.]+)$ /$1.php [L]
而且我想重写网址 . 例如
/detail.php?ca=38&title=rewrite uri sample
至
detail/article/38/rewrite uri sample
我尝试搜索整个www,然后我有一个答案..
RewriteEngine On Options +FollowSymLinks -MultiViews RewriteRule ^article/([0-9]+)/?$ detail.php?ca=$1 [NC,L] RewriteRule ^article/([0-9]+)/([A-Za-z0-9-]+)/?$ detail.php?ca=$1&title=$2 [NC,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]
使用
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]
GoDaddy
Options +MultiViews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L]
2 回答
我尝试搜索整个www,然后我有一个答案..
使用
GoDaddy