Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

4ung's avatar
Level 1

Deploy Laravel 5.2 on Shared host error showing domain.com/domain.com

RewriteEngine On RewriteCond %{HTTP_HOST} ^domain.com$ [NC,OR] RewriteCond %{HTTP_HOST} ^www.domain.com$ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ domain.com/public/index.php?/$1 [L] RewriteCond $1 !^/domain.com/

Above is my .htaccess file which work Fine perfectly on Godaddy server. But on ShweHosting (shared host), it automatically redirect to domain.com/domain.com when using home (root route). e.g. when i want to go domain.com but it always domain.com/domain.com. Is there something wrong with my configuration ? Please help

0 likes
5 replies
cviv's avatar

try this

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

    # Handle Authorization Header
    RewriteCond %{HTTP:Authorization} .
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
4ung's avatar
Level 1

LOL for some kind of reason it become domain.com/domain.com/domain.com and 500 internal server error :'(

my .htaccess file is not only able to access root ("/") but all other route works fine. like domain.com/login, etc.. .

Thanks for your interest please continue helping me i am really novice at server config.

4ung's avatar
Level 1

I revert back to my original .htaccess but its no longer working. it become domain.com/domain.com/domain.com. And it permanent.

4ung's avatar
4ung
OP
Best Answer
Level 1

@cviv @jlrdw Thanks both of you for your Attention. I finally solved after 5 days without sleep. The problem is caused by the redirect function of the domain & cpanel features and .htaccess.

Please or to participate in this conversation.