Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Redirect problem

Discussion in 'General Discussion' started by modrewrite, Nov 26, 2009.

  1. modrewrite

    modrewrite Registered

    Nov 26, 2009
    Likes Received:
    Trophy Points:
    Hello, I have a problem with .htaccess and I know it's likely to be apache or server related, but I think it also might be related to how subdomains are handled by cPanel.

    I have a subdomain with lots of directories inside. The subdomain was set thru cPanel.

    I want this to be rewritten to
    yet not shown in the address bar.

    I have created this .htaccess file:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /

    RewriteCond %{REQUEST_FILENAME} !-f

    RewriteCond %{HTTP_HOST} ^$ [NC]
    RewriteRule ^(.*)$ /show.php?w=$1 [L]

    However, there is a problem when the URLs don't end with a slash, like this: displays in the address bar correctly, however does redirect properly, but displays as in the address bar. Which is weird.

    This happens with any level of subdirectories, i.e.

    I have noticed that this only happens when the URL is handling real directories.
    Let's say dir1 exists. displays
    but if dir2 doesn't exist, remains unchanged in the address bar.

    My subdomain is also accessible as a subdirectory of the main domain:
    Could there be the problem? Also in cPanel redirect section I see this: / /show.php?w= temporary

    I searched high and low but haven't found a way to fix that.
    Hope somebody could help. Thanks!

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice