2012-04-14 64 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