views:

63

answers:

1

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

+1  A: 

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!

sprain
Thnks .It work fine now..But its redirecting correctly for few pages.But not displaying images,css for a single page, which is in the same directory
Vithya
Yep, this only takes care of the pages. If you also want to redirect other kind of files you need to have redirect rules for them as well. Depending on your setting it might all be done with just one rule. But I can only repeat myself and say, that this is something that can't be seen by your example. But you know the trick now and you'll figure it out :)
sprain