Jump to content

Htaccess Redirect


sugan

Recommended Posts

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

It should be as
Why is it not working?Kindly help!Regards,Suganya
Link to comment
Share on other sites

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...