【发布时间】:2016-09-15 16:44:26
【问题描述】:
我正在尝试像这样重定向我的链接:
我的 href = example.com/?p=users&page=2
我的网址应该是 = example.com/users/page/2
此时,我的 mod_rewrite 正在使用:
我的href = example.com/?p=users
我的网址 = example.com/users
这是我的 htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/index.php
RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
</IfModule>
【问题讨论】:
-
您应该做的第一件事是将您的
href更改为您想要的(规范)URL。否则(一旦实施),您最终会将 每个 请求重定向到规范 URL(对用户来说可能很慢,服务器访问量是两倍等)。 -
我的 href 已经是规范的 (users/page/2) 但还没有工作
标签: apache .htaccess mod-rewrite