I have developed a website on l4 now I am trying to upload it on a shared server online. The app is accessible from a subdomain http://bookcheetah.thedevs.org or http://thedevs.org/bookcheetah but the only problem is that whenever you try to click around or search you are always getting 404 errors. I tried different ways like this one and this one but still I get 404 errors when I click around. Could it be the subdomain? Please help me resolve this error.

有帮助吗?

解决方案

I created a .htaccess file in my document root with the following code:

        <IfModule mod_rewrite.c>
            Options -MultiViews
            RewriteEngine On

            RewriteCond %{REQUEST_FILENAME} !-d
            RewriteCond %{REQUEST_FILENAME} !-f
            RewriteRule ^ index.php [L]
        </IfModule>

That solved the problem!

其他提示

Looks like a issue with mod_rewrite. If you access your routes via index.php ie http://bookcheetah.thedevs.org/index.php/howitworks they appear to be working fine.

Check to see if mod_rewrite is enabled on the server and that your .htaccess file has the correct rules.

Just to get all answers in one place.

If you can access your pages in the manner dragoon mentioned (e.i. http://yourdomain.com/yoursubfolder/index.php/yourpage ) but when you try to access the same page without "/index.php" part you see "not found error" you might try to add in your .htaccess (in "/public" folder) file following line:

just after:

<IfModule mod_rewrite.c>
        Options -MultiViews
        RewriteEngine On

add the following line (the trailing slash is important if you use stock .htaccess from Laravel) :

RewriteBase /yoursubfolder/

That should tell your web server to serve files from "yoursubfolder" as if they where in "/" base folder.

Hope that helps someone.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top