我需要使用SEO制作URL rewriting个友好网址:
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
我的网址重写根本不起作用,
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文件放在哪里?在根目录或子文件夹中?
答案 0 :(得分:0)
这应该可行:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^([^/]*)/([^/]*)/([^/]*)\.html$ /subfolder/$3.php?service=$1&location=$2 [L]
你应该把它放在根目录中。