mod_rewrite在重写之前截断URL

时间:2023-02-10 11:22:33

I have this in my .htaccess file

我在.htaccess文件中有这个

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) /index.cfm?urlparam=/$1 [L,QSA]
</IfModule>

urlparam only ever returns the first two parameters after the domain

urlparam只返回域后面的前两个参数

i.e if i type

即如果我输入

www.blahblah.com/competitions/display/competition01/

and then write the contents of urlparam i only ever get /competitions/display/

然后写urlparam的内容我只得到/竞赛/显示/

Can anyone mke any suggestions mod rewrite is a bit of a black art to me.

任何人都可以mke任何建议mod重写对我来说有点黑色艺术。

1 个解决方案

#1


Try the REQUEST_URI variable instead:

请尝试使用REQUEST_URI变量:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.cfm?urlparam=%{REQUEST_URI} [L,QSA]

#1


Try the REQUEST_URI variable instead:

请尝试使用REQUEST_URI变量:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.cfm?urlparam=%{REQUEST_URI} [L,QSA]