问题
So I'm wondering if anyone would be willing to help me, or tell me if it's possible to do what I'm thinking of for my urls.
So I want the urls to be like so
http://www.example.com/(seriesname)/season/(seasonnumber)/episode/(episodenumber)
The variables surrounded by '()' will need to be php variables that I can parse. Is this possible/any help on the regex for mod rewrite.
And I could also go to lets say sub parts of the url to just show all episodes in a season or all seasons. EG: http://www.example.com/(seriesname)/season/(seasonnumber) will display all episodes in specified season.
回答1:
here you go:
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
来源:https://stackoverflow.com/questions/14176618/apache-rewrite-clean-url