无法重写get变量url

时间:2015-11-11 09:53:16

标签: apache .htaccess mod-rewrite

我可以将网址localhost/web1/index.php?page=home重写为localhost/web1/home

但我无法将网址localhost/web1/index.php?page=property_details&pid=1008&aid=283重写为localhost/web1/property_details/1008/283

以下是我使用过的代码:

Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteBase /web1/
RewriteCond %{THE_REQUEST} \s/+web1/?(?:index\.php)?\?page=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/.]+)/?$ index.php?page=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]

0 个答案:

没有答案