2013-07-26 88 views

回答

5

你需要使用.htaccess文件来做这个重写操作,而不需要在浏览器中调用url, 尝试下面的代码

RewriteEngine On #remove this if already added 
RewriteRule ^search/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ search.php?s1=$1&s2=$2 [NC,L] 
0

我这样做:

RewriteEngine On #if not already on. 
RewriteCond %{REQUEST_FILENAME} !-f #only if it is not calling a file that actually exists 
RewriteCond %{REQUEST_FILENAME} !-d #only if it is not calling a directory that actually exists. 
RewriteRule ([a-z0-9]+)(/*)([a-z0-9]*)(/*)([a-z0-9]*)(/*) search.php?v1=$1&v2=$3 [L,NC,QSA] 

这甚至会工作,如果你只去/移动/(假设你的search.php就可以搞定。)

HTH