开发者

to write htaccess code for friendly url

开发者 https://www.devze.com 2022-12-21 12:05 出处:网络
I need a help, does anyone can tell me how to change a url \"http://www.domain.com/search.php?key=+Ebooks&type=title&Submit=Search\"

I need a help, does anyone can tell me how to change a url

"http://www.domain.com/search.php?key=+Ebooks&type=title&Submit=Search"

to

"http://www.domain.com/keyword- keyword- keyword.html".

i have written following htaccess code but its not working.

<I开发者_运维知识库fModule mod_rewrite.c>

RewriteEngine on

RewriteRule search-(.*)-(.*)-(.*)\.html search.php?key=$1&type=$2&page=$3
</IfModule>


What exactly does not work? Is anything happening?

I am not 100% sure but I think you have to do it this way:

search-(.*?)-(.*?)-(.*?)\.html search.php?key=$1&type=$2&page=$3

Notice the ? behind the asterisks. It indicates to match a string as early as possible.


Try this:

RewriteRule search-([^-]*)-([^-]*)-([^-]*)\.html search.php?key=$1&type=$2&page=$3
0

精彩评论

暂无评论...
验证码 换一张
取 消