[英]Remove sub folder url in htaccess
I have got it right to remove my subfolder from the url but its making my other root sub folders not pick up. 我已经正确地从URL中删除了我的子文件夹,但是这使我的其他根子文件夹无法使用。
Eg... 例如...
www.blah.com/templates/index.html is now www.blah.com/index.php www.blah.com/templates/index.html现在为www.blah.com/index.php
but my www.blah.com/systemfiles/signin.php gives an error 但是我的www.blah.com/systemfiles/signin.php给出了错误
I also have www.blah.com/systemfile/signin.php. 我也有www.blah.com/systemfile/signin.php。 I can not access other sub folders.
我无法访问其他子文件夹。
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/templates
RewriteRule ^(.*)$ templates/$1 [L]
The four lines you added says: 您添加的四行内容是:
That is why it does not work for you. 这就是为什么它对您不起作用的原因。 This strategy is kind of weird... But to make it work with your example you should check if the url points to a file or folder.
这种策略有点奇怪...但是要使其与您的示例一起使用,您应该检查url是否指向文件或文件夹。
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/templates
RewriteRule ^(.*)$ templates/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.