开发者

URL rewrite - Automatically - not manual

开发者 https://www.devze.com 2023-01-11 15:10 出处:网络
I have written a rule for redirecting in .htaccess file开发者_如何学运维 its redirecting for some pages , if we give that link manually..

I have written a rule for redirecting in .htaccess file开发者_如何学运维 its redirecting for some pages , if we give that link manually.. but what i want is ,it should redirect automatically....

My requirement is :

Instead of this link,

links.php?page=1&ipp=All&exchange=adddata

It should be redirected automatically

http://example.com/folder1/links/1/All/exchange.html

MY rule in .htaccess is

RewriteEngine On RewriteRule ^([0-9]+)/All/exchange.html$ links.php?page=1&ipp=All&exchange=adddata


It's not completely clear by your example, but it could be this:

RewriteEngine On   
RewriteRule ^links.php?page=([0-9]+)&ipp=All&exchange=adddata$  folder$1/links/$1/All/exchange.html

In the comment above you mistakenly swaped the original url and the url it should be redirected to plus you didn't set any dynamic parameters in your new url - which I suppose you need. But as I said, to be sure about it we'd need more examples.

Hope this helps!

0

精彩评论

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

关注公众号