RewriteRule for tilde

拟墨画扇 提交于 2019-12-06 09:04:02

I was able to fix any hits to http://domain.ext/~blog/file.html with this .htaccess rule at webroot (public_html):

RewriteRule ^~blog/(.*)$ /site/legacy/users/blog/$1 [R=301,L]

From: http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml

It is probably linked to the use mod_userdiras you mention. Please check in your apache configuration if it is now activated and see if disabling it fixes the issue.

http://httpd.apache.org/docs/2.2/mod/mod_userdir.html

I use this rule to redirect everything which starts with tilde

RewriteCond %{REQUEST_URI} ^/~([a-z]+)/
RewriteRule ^(.*)$ http://www.mysite.fr/$1 [R=301,L]

From @Sigg3.net source : http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!