所以我有这个任务,我必须在一个域下基本上制作两个网页。主页必须经过index.php
。除了/子目录(在子目录下有另一个网页) - 然后使用子目录
示例:
这是我目前管理的内容:
#If
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !/subdirectory/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# rewrite
RewriteRule ^(.*)$ /forums/$1 [L]
# IF
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteCond %{REQUEST_URI} !/index.php
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# rewrite
RewriteRule ^(/)?$ index.php [L]
老实说,我没有想法......
了解如何操作:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !/forums
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
至今它的工作原理。