本文介绍了如何在url重写中隐藏子文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的网站是:www.mysite/subfolder/login/index.php
My site is : www.mysite/subfolder/login/index.php
我希望网址只是 www .mysite /登录/ index.php的。我尝试修改根文件夹中的.htaccess文件,如下所示:
I want the URL there to just be www.mysite/login/index.php. I tried modifying the .htaccess file in the root folder as follows:
RewriteRule ^login\/index\.php$ /subfolder/login/index.php [L]- 但问题在于它可以从登录文件夹中使用或访问CSS文件(style.css)。
--but the problem is that then it can't use or access the CSS file (style.css) from the login folder.
推荐答案# fix js/images/css RewriteRule ^.+?/((img|css|js)/.+)$ /subfolder/login/$1 [L,NC]
尝试在 htaccess 中添加它作为您的第一条规则。或者您可以使用
Try adding this as your first rule in htaccess. Or you can use
# fix js/images/css RewriteRule ^.+?/((img|css|js)/.+)$ www.yourdomain/subfolder/login/$1 [L,NC]您可以在此处看到更多示例和重写方式: https://wiki.apache / httpd /重写
You can see more examples and ways of rewriting here: wiki.apache/httpd/Rewrite
更多推荐
如何在url重写中隐藏子文件夹
发布评论