htaccess的重定向一切指标有异常重定向、异常、指标、htaccess

2023-09-02 01:08:39 作者:百分之百纯爷们

我怎么会重定向所有文件和文件夹的索引除外,只有满手?

现在我有这个,这是重定向的一切,包括所需的文件,如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]
 
4月3行情 清明时节思前人 合约杠杆血纷纷

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]