user874185
user874185

Reputation: 853

.htaccess file not rewriting url

im trying to do a rewite but for some reason its not rewriting correctly. my structure is suppose to look like this http://mysite.com/tv-show/showname/episode instead its doing http://mysite.com/tv-show/episode

this is my code

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^tv-shows/(.*?)/(.*?)/ /index.php?name=$2 [NC]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

It looks fine, is there anything im missing?

Upvotes: 1

Views: 122

Answers (1)

Book Of Zeus
Book Of Zeus

Reputation: 49885

try this:

RewriteEngine On
RewriteRule ^tv-show(s?)/([a-z0-9\-_]+)/([a-z0-9\-_]+)/? /index.php?name=$3 [NC,L]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Upvotes: 2

Related Questions