[英]how htaccess rewrite works
htaccesss代码如何工作以及它们如何用于重定向链接,为什么使用index.php?
<IfModule mod_rewrite.c>
RewriteEngine On
#RewriteBase /XYZ/
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
RewriteEngine On # Enable the rewrite engine
RewriteBase /XYZ/ #The base url can also be called as root url
RewriteRule ^index.php$ - [L] #Content between ^ $ are rewritten [L] is a flag
RewriteCond %{REQUEST_FILENAME} !-f # Don't select files
RewriteCond %{REQUEST_FILENAME} !-d #Don't select directory
检查Apache文档https://httpd.apache.org/docs/current/rewrite/flags.html中的标志
还有更多问题要问。
旁注如果您有多种情况,请使用此选项
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.