1
我想只在我的网站上使用带有斜线的URL。目前,我只有不含斜杠的网址。我如何修改我的htaccess?将斜线重定向到带有斜线的URL
这就是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^(.*)/[0-9]+$ %{REQUEST_URI}/ [QSA,L,R=301]
RewriteRule ^unternehmen-2-2/?$ /unternehmen [L,R=301,NC]
RewriteRule ^expose/(.*)/$ content/index.php?content=expose&query=$1 [L,QSA]
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
我希望有人能帮助我。
谢谢您的回答...当我尝试您的解决方案没有任何反应......我还是没有尾随斜线路径。内部路径显示为带有尾随垃圾的网址,然后重定向到“无尾随垃圾”... – tom84
请将我的“添加尾随斜杠”作为您的第一条规则,然后在禁用缓存的Chrome开发工具中进行测试,并签入“网络”选项卡什么是您获得的301/302重定向网址。 – anubhava
我没有重定向。所有网站得到200.现在我有你的代码在我的htaccess,如果你想检查... – tom84