Forum Moderators: phranque
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>
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..