這是我的場景。我的應用程序的URL都表現出這樣的:用htaccess重定向兩個文件
example.com/index.php/article/whatever/here
,以移除網址我在的.htaccess把這個和的index.php正常工作:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
現在,我的問題是,我有包括和admin.php的是這樣的:
example.com/admin.php/manage/whatever/here
我不知道如何從URL,而不使用的index.php conflics刪除admin.php的,因爲我已經嘗試這樣做,一個500內部服務器錯誤我小號表明:
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteRule ^(.*)$ /admin.php/$1 [L]
編輯
另一個嘗試是此而已,因爲一個404錯誤顯示:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*?)/(.*) /$1/$2 [L]
ALL我的網址應該有幾個parameteres作爲該電源線:
編輯2:我已經創建了兩條規則,每條規則獨自運作良好!但兩者不能一起工作:
RewriteRule ^admin/(.*)$ /admin.php/$1 [L]
RewriteRule ^(.*)$ /index.php/$1 [L]
..應該如何阿帕奇知道你想要哪一個,如果你送給他一樣正則表達式兩個? (全部並將其添加到..索引和admin.php) – Rufinus
你是對的,但我怎麼能在這裏實現AND條件? – manix
不,你不明白你的查詢是相同的兩個網址..'^(。*)$'如何可以Apache現在如果它的index.php或admin.php? 500error只是說你有多於一次的相同的正則表達式。擴展正則表達式,並將第一個規則的index.php和第二個規則的admin.php包括到正則表達式源中。 – Rufinus