2

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.

Community
  • 1
  • 1
Timothy
  • 4,198
  • 6
  • 49
  • 59

3 Answers3

4

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!

Timothy
  • 4,198
  • 6
  • 49
  • 59
3

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.

dragoon
  • 451
  • 4
  • 3
  • Thank you so much! atleast i can see my app work. I dont see any .htaccess file on the directory or even on the public_html directory. How do I check id mod_rewrite is enabled on a normal cpanel account? – Timothy Jul 19 '13 at 07:24
  • Thanks, i created a .htaccess file in my document root with the mod_rewrite – Timothy Jul 19 '13 at 12:51
3

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.

Jakub Gadkowski
  • 171
  • 1
  • 5
  • Hey, which subfolder did you mean? – Timothy Sep 15 '13 at 22:35
  • @TechyTimo Say you have a domain http://iamdomain.com/ and you want to serve your Laravel app from a subfolder /iamsubfolder so the full path is http://iamdomain.com/iamsubfolder then RewriteBase directive will be: `RewriteBase /iamsubfolder/` – Jakub Gadkowski Oct 08 '13 at 20:56