本文介绍了htaccess的重定向一切指标有异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我怎么会重定向所有文件和文件夹的索引除外,只有满手?
现在我有这个,这是重定向的一切,包括所需的文件,如CSS和JS文件的网站的功能。
RewriteEngine叙述上
的RewriteCond%{HTTP_HOST} mysite.com
的RewriteCond%{REQUEST_URI}!^ / index.php文件
重写规则^(。*)$的index.php [L,R = 301]
解决方案
尝试添加重写规则上面下面。
的RewriteCond $ l ^(cssfolder | otherfolders)!
如果您将应用上面你的.htaccess,它想是这样的:
RewriteEngine叙述上
的RewriteCond%{HTTP_HOST} mysite.com
的RewriteCond%{REQUEST_URI}!^ / index.php文件
的RewriteCond $ l ^!(cssfolder | otherfolder1 | otherfolder2 | otherfolder3)
重写规则^(。*)$的index.php [L,R = 301]
How would I redirect all files and folders to index with the exception of only a hand full?
Right now I have this, which is redirecting everything, included needed files such as css and js files for site functionality.
RewriteEngine on
RewriteCond %{HTTP_HOST} mysite.com
RewriteCond %{REQUEST_URI} !^/index.php
RewriteRule ^(.*)$ /index.php [L,R=301]
解决方案
Try adding the following above the RewriteRule.
RewriteCond $1 !^(cssfolder|otherfolders)
If you would apply the above to your .htaccess, it would like something like:
RewriteEngine on
RewriteCond %{HTTP_HOST} mysite.com
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond $1 !^(cssfolder|otherfolder1|otherfolder2|otherfolder3)
RewriteRule ^(.*)$ /index.php [L,R=301]
这篇关于htaccess的重定向一切指标有异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!