从子域子目录路径htaccess的内部重写子目录、重写、路径、从子

由网友(稚浪)分享简介:林在至少24小时忙碌在这个问题上,我似乎无法获得此脚本工作。该脚本犯规重定向的。Im at least 24 hours busy on this subject, I cant seem to get this script to work. The script doesnt redirect at all.R...

林在至少24小时忙碌在这个问题上,我似乎无法获得此脚本工作。该脚本犯规重定向的。

Im at least 24 hours busy on this subject, I cant seem to get this script to work. The script doesnt redirect at all.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^m.skynet.com$
RewriteRule ^/(.*)$ /mobile/final/$1 [L,NC]

我是什么做错了吗?

What am I doing wrong?

更新:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^m.skynet.com$
RewriteCond %{REQUEST_URI} !^/mobile/final/
RewriteRule ^(.*)$ /mobile/final/$1 [L,NC]

这部分的工作,但像m.skynet.com 环节的download.php不会被重定向

This partially works, but links like m.skynet.comdownload.php wont get redirected

更新:45分钟后

现在突然的作品。 但是,URL重写获取在FireFox,而在Chrome浏览器能够正常工作

Now it suddenly works. But the URL gets rewritten in FireFox, while in Chrome it works properly

更新 似乎与火狐的问题是由一个301重定向我之前使用造成的,缓存已经被刷新。它正常工作了。

UPDATE Seems that the problem with Firefox was caused by a 301-redirect I used earlier, the cache had to be flushed. for it to work properly again

推荐答案

从比赛中删除斜线:​​

Remove leading slash from match:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^m.skynet.com$
RewriteCond %{REQUEST_URI} !^/mobile/final/
RewriteRule ^(.*)$ /mobile/final/$1 [L,NC]

的.htaccess 是每个目录指令和Apache条从重写规则 URI的当前目录路径(从而导致斜线)格局。 您需要的RewriteCond%{REQUEST_URI}!^ /移动/最后/ 来prevent循环。

.htaccess is per directory directive and Apache strips the current directory path (thus leading slash) from RewriteRule URI pattern. You need RewriteCond %{REQUEST_URI} !^/mobile/final/ to prevent looping.

阅读全文

相关推荐

最新文章