好的,我需要进行重定向,重定向很好,但我在网址的末尾得到了额外的东西
这是我的重定向
redirect 301 /cash_registers/index.html http://posnation.com/cash_registers
这是我的整个htaccess
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?route=$1 [L]
# # Remove the trailing slash
# RewriteCond %{HTTP_HOST} ^(www.)?posnation\.com$ [NC]
# RewriteRule ^(.+)/$ http://www.posnation.com/$1 [R=301,L]
RewriteCond %{HTTP_HOST} ^(www.)?posnation\.com$ [NC]
# Only apply to URLs that aren't already under folder1.
RewriteCond %{REQUEST_URI} !^/our_customers/
# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Rewrite all those to insert /folder1.
RewriteRule ^(.*)$ /our_customers/$1
redirect 301 /cash_registers/index.html http://posnation.com/cash_registers
当我去网址http://posnation.com/cash_registers/index.html时,我会在网址的末尾收到各种垃圾......有没有办法解决这个问题
这是网址末尾的垃圾
cash_registers?route=cash_registers/index.html
答案 0 :(得分:2)
男人,这不是一个错误,这是一个功能。这一行:
RewriteRule ^(.*)$ index.php?route=$1 [L]
实际上是将“垃圾”添加到网址的末尾。 如果你想摆脱它 - 意味着没有查询字符串 - 用这个替换该行:
RewriteRule ^(.*)$ index.php? [L]
我不确定这不是故意的,所以它可能会破坏你网站的其他功能。
答案 1 :(得分:2)
您需要专门定位要重写的链接,如下所示:
RewriteRule ^retail_pos/(.*)/?$ /index.php?route=$1 [R=301,L]
RewriteRule ^shop_pos/(.*)/?$ /index.php?route=$1 [R=301,L]