我有几个URL像
www.mydomain/state$c$c1-folder1
我想将其重定向到/文件夹1 /页,但我想说明的原始网址如上在浏览器地址栏。
请注意,我没有文件夹状态code1-文件夹1和国家code2-文件夹1
目前我用的是下面的.htaccess会被重定向,但它改变地址栏
#Options +的FollowSymLinks RewriteEngine叙述上 的RewriteBase / 的RewriteCond%{REQUEST_URI} ^ /状态code1-文件夹1 $ 重写规则^(+)/文件夹1 [L] 的RewriteCond%{REQUEST_URI} ^ /状态code2-文件夹1 $ 重写规则^(+)/文件夹1 [L]解决方案
您不应该有斜线后面的空间!而故事的结局$也许这是什么问题?通常情况下,当地的重定向应该工作。尝试是这样的:
RewriteEngine叙述上 的RewriteBase / 的RewriteCond%{REQUEST_URI} ^ /状态code1-文件夹1 重写规则^ * /文件夹1 [L] 的RewriteCond%{REQUEST_URI} ^ /状态code2-文件夹1 重写规则^ * /文件夹1 [L]I have few urls like
www.mydomain/statecode1-folder1
I want to redirect it to /folder1/ page but I want to show the the original urls as above in the browser address bar.
Please note that I do not have folders statecode1-folder1 and statecode2-folder1
Currently I use the below .htaccess which redirects but it changes the address bar
#Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/ statecode1-folder1 $ RewriteRule ^(.+) / folder1 [L] RewriteCond %{REQUEST_URI} ^/ statecode2-folder1 $ RewriteRule ^(.+) / folder1 [L]解决方案
You shouldn't have spaces after slash! And the ending $ Maybe it is the problem? Normally, local redirect should work. Try something like this:
RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/statecode1-folder1 RewriteRule ^.* /folder1 [L] RewriteCond %{REQUEST_URI} ^/statecode2-folder1 RewriteRule ^.* /folder1 [L]
更多推荐
htaccess的重定向不改变网址
发布评论