1

我无法让以下工作:
我有我的基本域:www.mydomain.com
我想通过 .htaccess 文件重定向用户,如下所示:
如果有人键入:

www.mydomain.com/id


然后它将重定向到:

www.mydomain.com/directory/process?id=id



这是我尝试过的:

RewriteEngine On
RewriteRule ^v/([^/]*)$ /directory/process?id=$1 [L]

我已经把它放在根目录(又名 mydomain.com/)
提前谢谢。

4

1 回答 1

1

要重写/id为,如果请求不是针对真实的现有文件,则/directory/process?id=xxx捕获第一个之前的所有内容。/

RewriteEngine On
# Don't rewrite if the request is for a real file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# ([^/]+) captures everything up to the first / in $1
RewriteRule ^([^/]+) directory/process?id=$1 [L]
于 2012-08-07T16:57:34.807 回答