Cpanel redirect method not working

Discussion in 'Bug Reports' started by felosi, Jun 23, 2011.

  1. felosi

    felosi New Member

    not sure how long its been like this or if cpanel changed, not sure if it ever worked. I thought it did. But recently tried to add some redirects from cpanel and simply didnt work in ,.htaccess, tried adding same rules to httpd.conf didnt work. here are the rules that didnt work.

    Running current version of lsws

    Code:
    RewriteCond %{HTTP_HOST} ^hostingsplus\.com$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.hostingsplus\.com$
    RewriteRule ^vps\-hosting$ "http\:\/\/hostingsplus\.com\/your\-choice\-of\-hosting\/vps\-hosting\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^shared\-hosting$ "http\:\/\/hostingsplus\.com\/your\-choice\-of\-hosting\/shared\-hosting\/" [R=301,L]
    
    RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^ddos\-protected\-hosting$ "http\:\/\/hostingsplus\.com\/your\-choice\-of\-hosting\/ddos\-protected\-hosting\/" [R=301,L]
    
    I had to change it to these rules manually to get it to work:

    Code:
    Redirect /shared-hosting http://hostingsplus.com/your-choice-of-hosting/shared-hosting/
    Redirect /ddos-protected-hosting http://hostingsplus.com/your-choice-of-hosting/ddos-protected-hosting/
    Redirect /vps-hosting http://hostingsplus.com/your-choice-of-hosting/vps-hosting/
    Redirect /reseller-hosting-plans http://hostingsplus.com/your-choice-of-hosting/reseller-hosting-plans/

    I have had to do this for a few clients so far.
  2. webizen

    webizen New Member

    Based on the redirects, try the following rewrite rules in .htaccess
    Code:
    #RewriteCond %{HTTP_HOST} ^hostingsplus\.com$ [OR]
    #RewriteCond %{HTTP_HOST} ^www\.hostingsplus\.com$
    RewriteRule ^vps-hosting$ "http://hostingsplus.com/your-choice-of-hosting/vps-hosting/" [R=301,L]
    
    #RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^shared-hosting$ "http://hostingsplus.com/your-choice-of-hosting/shared-hosting/" [R=301,L]
    
    #RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^ddos-protected-hosting$ "http://hostingsplus.com/your-choice-of-hosting/ddos-protected-hosting/" [R=301,L]
    
    #RewriteCond %{HTTP_HOST} ^.*$
    RewriteRule ^reseller-hosting-plans$ "http://hostingsplus.com/your-choice-of-hosting/reseller-hosting-plans/" [R=301,L]
    
    Also add following lines to the hostingplus.com vhost section in httpd.conf to enable rewritelog for debugging (error_log).

  3. felosi

    felosi New Member

    I know what has to be done to MANUALLY edit the .htaccess. But what I reported is simple - When you add a site redirect inside CPANEL the rewrite rules it puts in the .htaccess do not work with litespeed which means litespeed is not fully compatible with cpanel.

    I or other hosts cannot simply wait until a client trys to add a redirect, see it not work, put in ticket and manually edit their .htaccess.

    take it how you will, I dont need to know what to put where. It does not work default with cpanel on a fresh server so therefore I think is a legit bug request.

    Also I have already tried what you suggested, commenting out the rewritecond, same thing.
  4. webizen

    webizen New Member

    Should have mentioned that the rules you posted in the first place (NOT manually edit) are also fine in our lab testing with the latest LSWS. It must be something else.

    Did you enable Rewrite Logging and see why those rules are not working for you?

    BTW, what's the LSWS version in question?
    Last edited: Jun 24, 2011

Share This Page