我对.htaccess进行了更改,网址已正确停止重写。目前看起来像这样:
<IfModule mod_rewrite.c>
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
我想让“www”始终显示,并且它有效,但网址现在看起来像:
http://www.e/example/es/1-bienvenidos?lang=es&id=1
而不是
http://www.e/example/es/1-bienvenidos
这是配置部分的其余部分:
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteRule ^(en|es)/([0-9]+)-(.+)/?$ content.php?lang=$1&id=$2
</IfModule>
答案 0 :(得分:0)
重定向规则(强制www)在其他规则之后
您需要在任何路由规则之前使用重定向规则。通过诸如content.php
文件之类的东西来路由请求的规则将否定外部重定向的点。