我正在尝试对代字号URL进行以下重写:
RewriteRule ^/?~folder/(.*) http://whatever.com/$1 [R=302,L]我希望任何与whatever.com/~folder/something的链接成为whatever.com/something。
如果我的情况排除了波浪号(也尝试转义它,\~ ),上面的重写规则似乎是有效的,但对于波浪号,它不执行重写。
是否有更广泛的配置设置需要调整才能在我的情况下启用重写?我知道~folder通常指的是用户的主目录,但我不知道它是如何起作用的,也不知道在我的情况下如何调整。
发布于 2013-07-10 19:29:24
我可以在webroot (Public_html)用这个.htaccess规则修复http://domain.ext/~blog/file.html的任何命中:
RewriteRule ^~blog/(.*)$ /site/legacy/users/blog/$1 [R=301,L]来自:http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml
发布于 2011-11-18 18:28:47
它可能与您提到的使用mod_userdir有关。请检查您的apache配置是否现在已激活,并查看禁用它是否可以解决此问题。
http://httpd.apache.org/docs/2.2/mod/mod_userdir.html
发布于 2015-01-15 22:33:47
我使用此规则重定向以代字号开头的所有内容
RewriteCond %{REQUEST_URI} ^/~([a-z]+)/
RewriteRule ^(.*)$ http://www.mysite.fr/$1 [R=301,L]来自@Sigg3.net来源:http://webmaster.iu.edu/tools-and-guides/maintenance/redirect-htaccess.phtml
https://stackoverflow.com/questions/7193531
复制相似问题