LiteSpeed Support Forums

LiteSpeed Support Forums (http://www.litespeedtech.com/support/forum/index.php)
-   General (http://www.litespeedtech.com/support/forum/forumdisplay.php?f=25)
-   -   Rewrite rule not work ! (http://www.litespeedtech.com/support/forum/showthread.php?t=6450)

pardis 12-12-2012 11:38 AM

Rewrite rule not work !
 
Hello :

It is appear Rewrite_mode rule not worked on sever , this is important rule for almost user.

Example :

RewriteCond %{HTTP_HOST} ^dl\.lianportal\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dl\.lianportal\.com$
RewriteRule ^/?$ "http\:\/\/lianportal\.com" [R=301,L

Thanks

NiteWave 12-12-2012 04:55 PM

try:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^dl\.lianportal\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dl\.lianportal\.com$
RewriteRule ^(.*)$ http://lianportal.com/$1 [R=301,L]

webizen 12-12-2012 07:55 PM

Quote:

Originally Posted by pardis (Post 38980)
Hello :

It is appear Rewrite_mode rule not worked on sever , this is important rule for almost user.

Example :

RewriteCond %{HTTP_HOST} ^dl\.lianportal\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dl\.lianportal\.com$
RewriteRule ^/?$ "http\:\/\/lianportal\.com" [R=301,L

Thanks

It should work in httpd.conf (not .htaccess) as follows:

RewriteCond %{HTTP_HOST} ^dl\.lianportal\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.dl\.lianportal\.com$
RewriteRule ^/?$ "http\:\/\/lianportal\.com" [R=301,L]

Note that it is for URL contains with "/" or "" ONLY, not for everything else. If you need rewrite for everything else, you should use

RewriteRule ^/(.*)$ "http\:\/\/lianportal\.com/$1" [R=301,L]

/ (slash after ^) is needed if rules are in httpd.conf. No need in .htaccess.

You can put 'RewriteLogLevel 9' in the httpd.conf to enable rewrite logging and grep REWRITE entry in error_log for debugging.


All times are GMT -7. The time now is 04:07 AM.