0

There are hundreds of urls are returning with server error. Here is the example url

http://www.example.com/index.php?option=com_nap&format=raw&view=googlemapshow&vw_name=tabbed_compact&pid=12196

If I see an url with a string value as "com_nap", i need to redirect to my sub domain.

The above url should be redirected to

http://subdomain.example.com/index.php?option=com_nap&format=raw&view=googlemapshow&vw_name=tabbed_compact&pid=12196

How can I do that in htaccess.

regards, Raja

1 Answer 1

1

I assume your webserver runs apache and has the mod_rewrite enabled?
In this case, you could match the QUERY_STRING (part behind the ? mark) against a regular expression.

Like so:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{QUERY_STRING} ^option=com_nap [NC]
  RewriteRule ^ http://subdomain.example.com%{REQUEST_URI} [R=301,L]
</IfModule>

1) You turn on the Rewrite Engine if its available
2) You check the QUERY_STRING wether it starts with option=com_nap
3) You redirect with a 301 to the subdomain

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.