0

需要帮忙

我有这样的链接

http://www.mysite.com/obj/task/land/city/41277/landId/19/Best+Restaurant//Sville%20city

使用 htaccess

RewriteRule ^l/([0-9]+)/([0-9]+)/?$ index.php?obj=obj&task=land&city=$1&landId=$2
RewriteRule ^l/([0-9]+)/([0-9]+)$ index.php?obj=obj&task=land&city=$1&landId=$2

现在我的链接看起来像这样

 http://www.mysite.com/l/41277/19

我应该在我的 htaccess 上添加什么以便我的这样的链接将被接受

http://www.mysite.com/l/41277/19/Best+Restaurant//Sville%20city
http://www.mysite.com/l/41247/17/Best+parks/Cold%20Province/Platinum%20city
4

1 回答 1

1

通过启用 mod_rewrite 和 .htaccess httpd.conf,然后将此代码放在您.htaccessDOCUMENT_ROOT目录下:

Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^l/([0-9]+)/([0-9]+)/? /index.php?obj=obj&task=land&city=$1&landId=$2 [L,QSA,NC]
于 2013-06-26T11:20:24.907 回答