简体   繁体   中英

URL rewrite - Automatically - not manual

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!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM