2012-04-14 113 views
0

我需要从制造SEO友好的URL与URL rewriting创建SEO友好的URL与URL重写

http://www.myurl.com/subfolder/index.php?service=example1&location=city1 

http://www.myurl.com/subfolder/cars.php?service=example1&location=city1 

http://www.myurl.com/subfolder/bicycle.php?service=example1&location=city1 

http://www.myurl.com/subfolder/example1/example2/index.html 

http://www.myurl.com/subfolder/example1/example2/cars.html 

http://www.myurl.com/subfolder/example1/example2/bicycle.html 

我的URL重写不会在所有的工作,

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^index/(\w+)/?$ index.php?service=$1&location=$2 
RewriteRule ^cars/(\w+)/?$ cars.php?service=$1&location=$2 
RewriteRule ^bicycles/(\w+)/?$ bicycles.php?service=$1&location=$2 

我应该在哪里放置.htaccess文件?在根目录或子文件夹中?

+2

你确定你不想要:http://www.myurl.com/subfolder/cars/example1/city1.html? – 2012-04-14 07:56:01

回答

0

这也许应该工作:

Options +FollowSymLinks 
RewriteEngine On 
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /subfolder/$3.php?service=$1&location=$2 [L] 

你应该把它放在根目录下。

+0

我怎样才能调整此代码的以下链接: http://thegrantmag.com/issues?which=feb – alt 2012-04-15 02:11:10

+0

卡尔斯,做了这项工作? – Jeroen 2012-05-11 16:29:42