htcaccess 重定向子文件夹 - 转义可能错误?
我做了作业以防万一。
我正在尝试将 din.teknikblogg.nu (及其所有页面)重定向到 http://teknikblogg.nu
我尝试过有很多选择,但我无法使其发挥作用
有什么想法吗?
这就是我到目前为止所做的,
RewriteCond %{HTTP_HOST} ^din\.teknikblogg\.nu$ [NC]
RewriteRule ^(.*)$ http://teknikblogg.nu/$1 [QSA,R=301,L]
感谢您的帮助
I did my homework just in case.
I'm trying to redirect din.teknikblogg.nu (and all its pages) to http://teknikblogg.nu
I tried many options but I can't make it work
Any ideas?
this is what I have done so far
RewriteCond %{HTTP_HOST} ^din\.teknikblogg\.nu$ [NC]
RewriteRule ^(.*)$ http://teknikblogg.nu/$1 [QSA,R=301,L]
thanks for the help
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你的重写规则看起来很完美。
您是否确定已启用 mod 重写?
是在虚拟主机环境中还是在
.htaccess
文件中?两个提示:
如果您不在托管环境中(= 如果它是您自己的服务器并且您可以修改虚拟主机,而不仅仅是
.htaccess
文件),请尝试使用RewriteLog
指令:它可以帮助您追踪此类问题:我最喜欢的检查正则表达式的工具:
http://www.quanetic.com/Regex (不要忘记选择 ereg(POSIX) 而不是 preg(PCRE)!)
Your rewrite rule seem perfect.
Did you make sure that mod rewrite is enabled?
Is it in a vhost environment or in a
.htaccess
file?Two hints:
If you're not in a hosted environment (= if it's your own server and you can modify the virtual hosts, not only the
.htaccess
files), try to use theRewriteLog
directive: it helps you to track down such problems:My favorite tool to check for regexp:
http://www.quanetic.com/Regex (don't forget to choose ereg(POSIX) instead of preg(PCRE)!)