Q:

.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?

A:

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]

