.htaccess htaccess重写特定页面的代码
我正在我的.htaccess htaccess重写特定页面的代码,.htaccess,.htaccess,我正在我的htaccess文件中使用此重写规则: RewriteRule ^([\w/-]+)/?$ index.php?page_slug=$1 [L, QSA] 我如何以与上述相同的方式将domain.com/online shop/重定向到domain.com/online shop/home RewriteRule ^(online-shop)/?$ /$1/home [L,NC,R=302] RewriteCond %{REQUEST_FILENAME} !-d RewriteRu
htaccess
文件中使用此重写规则:
RewriteRule ^([\w/-]+)/?$ index.php?page_slug=$1 [L, QSA]
我如何以与上述相同的方式将
domain.com/online shop/
重定向到domain.com/online shop/home
RewriteRule ^(online-shop)/?$ /$1/home [L,NC,R=302]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^((?!online-shop/)[\w/-]+)/?$ index.php?page_slug=$1 [L,QSA,NC]
我只想
online shop
显示/重定向到online shop/home
,如果您不想更改URL,则从第一个规则中删除R=302
。为什么要在其中加入两个不同的规则?一个是您已经存在的规则,另一个是您的需求所需要的规则。