[英]htaccess remove folder from url only
im trying to remove only a specific folder from my url. 我试图从我的网址中只删除一个特定的文件夹。 i have see many answers here but i cant find any to work for me.
我在这里看到了很多答案,但我找不到对我有用的答案。 i have this url http://www.mydomain.com/projects/books/index.php i want to just remove the projects folder so i can use http://www.mydomain.com/books/index.php
我有这个网址http://www.mydomain.com/projects/books/index.php我只想删除项目文件夹,以便可以使用http://www.mydomain.com/books/index.php
i have this .htacces inside public_html folder : 我在public_html文件夹中有这个.htacces:
RewriteEngine on
RewriteCond %{REQUEST_URI} !(.*)projects
RewriteRule ^(.*)$ projects/$1 [L]
with this code i can access http://www.mydomain.com/books/index.php but any other address redirect me inside the projcets folder for example http://www.mydomain.com shows me the index of/ projects thank you 使用此代码,我可以访问http://www.mydomain.com/books/index.php,但是其他任何地址都可以在projcets文件夹中重定向我,例如http://www.mydomain.com向我显示了/项目的索引谢谢您
You can try this rule: 您可以尝试以下规则:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/(projects/|index\.php) [NC]
RewriteRule ^(.+)$ /projects/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.