2009-10-03 44 views
0

我怎麼可以重寫以下網址:如何使用htaccess重寫URL?

http://www.myurl.com/job/Accounting-Clerk-at-Department-of-Workforce-Services-in-Salt-Lake-City,-UT-1b6117567108f5a2 

到這些組件:

query = Accounting Clerk; 
cmp = Department of Workforce Services; 
location = Salt Lake City, UT; 
key = 1b6117567108f5a2; 

爲了得到這樣的結果:

index.php?q=$query&cmp=$cmp&l=$location&key=$key 
+0

我不認爲你需要這麼多的垃圾在您的網址 – UpTheCreek 2009-10-03 08:44:06

+6

「教我」不是我們這裏要提問的那種。 – Marius 2009-10-03 08:47:11

+3

你的工作確實如此嗎? http://www.indeed.com/job/Accounting-Clerk-at-Department-of-Workforce-Services-in-Salt-Lake-City,-UT-1b6117567108f5a2 – Gumbo 2009-10-03 08:48:56

回答

1
RewriteEngine on 
RewriteBase/

RewriteRule job/([^.]+)-in-([^.]+) index.php?var1=$1&var2ext=$2 

等繼續這樣

4

試試這個mod_rewrite規則:

RewriteEngine on 
RewriteRule ^job/([^/]+)-at-([^/]+)-in-([^/]+)-([0-9a-f]+)$ index.php?q=$1&cmp=$2&l=$3&key=$4