sugan Posted January 14, 2009 Share Posted January 14, 2009 Hai,I used redirect in my site. It took well in my previous host, but not in the new one... RewriteEngine onRewriteCond %{REQUEST_URI} ^/testing/(.*).htmlRewriteRule ^(.*).html http://example.com/testing/test.php?name=$1 [L] The redirection takes place, but the url shows like http://example.com/testing/test.php?name=$1It should be as http://example.com/testing/something.htmlWhy is it not working?Kindly help!Regards,Suganya Link to comment Share on other sites More sharing options...
boen_robot Posted January 14, 2009 Share Posted January 14, 2009 The two regular expressions you have are conflicting with each other. There's no way they'll both match at the same time.The RewrtieCond wants "^/testing/(.*).html" which would match "/testing/something.html", but not "something.html". The second one wants "^(.*).html" which would match "something.html" (relative to the .htaccess folder I think), but not "/testing/something.html". And in order for the rewrite to be executed, it must match both the RewriteCond and RewriteRule regular expressions.Also, when you have "http://" in your rewriting action (the second argument in RewriteRule), mod_rewrite performs a redirect instead of a rewrite. That reminds me - your title says "redirect", but you're talking about "rewrite". The difference between the two is that with rewrite, the user sees the original URL, and with a redirect, the user sees another URL. Well, that's the "user friendly" explanation anyway.Try to remove the RewriteCond, and make the RewriteRule something like: RewriteRule ^/testing/(.*).html /testing/test.php?name=$1 [L] Link to comment Share on other sites More sharing options...
sugan Posted January 14, 2009 Author Share Posted January 14, 2009 Hai,I tried yours but it did not work..As i told before, I tested with another server it worked...How to solve it? Is there any other option i can do?Regards,Suganya Link to comment Share on other sites More sharing options...
boen_robot Posted January 14, 2009 Share Posted January 14, 2009 O..k... try it with your rule and condition, but remove the "http://" in the rewrite action, i.e. leave that part as in my rule. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.