Forum Moderators: phranque

Message Too Old, No Replies

domain redirect to a URL with query string

domain redirect to a URL with query string

         

mmcds1974

7:30 pm on Oct 12, 2007 (gmt 0)

10+ Year Member



I am trying to use RewriteRule to redirect a domain to a URL that has query in it. For example I am trying to redirect www.example.com or example.com to https: //www.example.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=-1&storeId=13333&catalogId=13333&activeLink=Home

I have this in my Virtual Host stanza in my conf file, but It just gives me a blank page when trying to open www.example.com or example.com and the access log only shows it was hit with a 301 redirect and that is it. I am currently using the meta REFRESH in an index.html and that works good, but I don't want to do my redirect like that. Nothing in the error log that I can find. So do I have my RewriteRule set correctly? Any help would be appreciated. I do NOT use .htaccess file either.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_METHOD} ^TRACE
RewriteRule .* - [F]
RewriteRule ^/.*$ https: //www.example.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=-1&storeId=13333&catalogId=13333&activeLink=Home [R=301]
</IfModule>

akameng

9:27 am on Oct 17, 2007 (gmt 0)

10+ Year Member



hey, I am not sure, but just edit some bits

1- Use .htaccess file instead of mod_rewrite.c
2- Edit your code to:

#.htaccess file

RewriteEngine on
RewriteBase /

#specify which method you want to ignore
RewriteCond %{REQUEST_METHOD} ^(PUT¦DELETE¦TRACE¦CONNECT)
RewriteRule .* - [F]

#redirection
RewriteCond %{REQUEST_URI}!^/webapp/(.+)$
RewriteCond %{REQUEST_URI} .*
RewriteRule .* https: //www.example.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=-1&storeId=13333&catalogId=13333&activeLink=Home [QSA,L]

the above will do:
www.example.com/anything or example.com/anything to https: //www.example.com/webapp/wcs/stores/servlet/TopCategoriesDisplay?langId=-1&storeId=13333&catalogId=13333&activeLink=Home
but not
www.example.com/webapp/anything or example.com/webapp/anything

may this help you..