1
我有兩個htaccess文件,其中一個位於根目錄中,另一個位於禮物/目錄中。兩個.htaccess文件不能一起工作
根的.htaccess包含:
RewriteEngine on
RewriteCond %{REQUEST_URI} /gifts/
RewriteRule gifts/([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)$ gifts/catalog.php?catalog=$1 [NC,L]
RewriteCond %{REQUEST_URI} /gifts/
RewriteRule gifts/([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)/([0-9]+)$ gifts/catalog.php?catalog=$1&page=$2 [NC,L]
禮品/的.htaccess包含:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^gifts.example.com$ [NC]
RewriteRule ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)$ /catalog.php?catalog=$1 [NC,L]
RewriteCond %{HTTP_HOST} ^gifts.example.com$ [NC]
RewriteRule ^([A-Za-z0-9]+(?:-[A-Za-z0-9]+)*)/([0-9]+)$ /catalog.php?catalog=$1&page=$2 [NC,L]
當我去到以下網址:
它的工作原理,但下面的URL不起作用時
Not Found錯誤
對不起,沒不工作 – sAs59
它適用於http ://example.com/gifts/jeans now,but not for http://gifts.example.com/jeans – sAs59
此規則與'gifts.example.com/jeans'無關,因爲它位於'/ gifts /'目錄 – anubhava