2013-01-05 63 views
2

所以我想知道是否有人願意幫助我,或者告訴我是否有可能做我想爲我的網站做的事情。Apache重寫CLEAN網址?

所以我想在URL中,像這樣

http://www.example.com/(seriesname)/season/(seasonnumber)/episode/(episodenumber

包圍的變量「()」將需要PHP變量,我可以解析。這是可能的/任何幫助的正則表達式爲mod重寫。

而且我還可以讓我們說url的子部分,以顯示一季或全季的所有劇集。 EG: http://www.example.com/(seriesname)/season/(seasonnumber)將顯示指定季節中的所有劇集。

回答

0

在這裏你去:我有雖然

RewriteCond %{REQUEST_URI} !=/ 
RewriteCond %{REQUEST_URI} !robots.txt 
RewriteCond %{REQUEST_URI} !.php$ 
RewriteRule ^([^/]*)$ index.php?name=$1 
RewriteRule ^([^/]*)/season/([^/]*)$ index.php?name=$1&season=$2 
RewriteRule ^([^/]*)/season/([^/]*)/episode/([^/]*)$ index.php?name=$1&season=$2&episode=$3 
+0

的一個問題是 重寫規則^ /系列/([^ /] *)$ index.php文件名= $ 1 不能重寫的時候?我去http:// localhost/series/xxx – Jedigasm