的.htaccess URL重写到子目录 [英] .htaccess URL Rewrite to Subdirectory
本文介绍了的.htaccess URL重写到子目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是重写下面的/一些/子目录,以/一些/子目录/项目,像从这个事情的最好方法:
What is the best method to rewrite anything below "/some/subdir" to "/some/subdir/projects" like from this:
http://www.mydomain.com/some/subidr/test/
...这样的:
... to this:
http://www.mydomain.com/some/subdir/projects/test/
I found a similar question posted, but the solution didn't seem to work in my case. My current attempt so far (which doesn't seem to work):
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/projects/.*$
RewriteRule ^(.*)$ /projects/$1 [L]
编辑:我忘了提.htaccess文件将不得不坐在内/一些/子目录,因为我没有写访问服务器的Web根目录
I forgot to mention the .htaccess file would have to be sitting within /some/subdir as I don't have write access to the server's web root.
推荐答案
这是解决方案,我终于得到了工作:
This is the solution I finally got to work:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/some/subdir/projects/.*$
RewriteRule ^(.*)$ /some/subdir/projects/$1 [L]
这篇关于的.htaccess URL重写到子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文