2011-11-10 229 views
1

即时尝试做rewite,但由于某种原因,它不能正确重写。我的结构是假设这个样子http://mysite.com/tv-show/showname/episode而不是它做http://mysite.com/tv-show/episode.htaccess文件不重写url

这是我的代码

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

它看起来很好,有什么我思念?

+0

你的例子说,电视节目,但你的代码表示,电视节目 – duncan

回答

2

试试这个:

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] 
+0

我想你的代码,当我强调我的链接它确实给,但是我想,当我点击它的结构,它不会进入其页面,它只是刷新页面。 – user874185

+0

你能分享链接吗?或者你想要什么? –