1

I know this question is asked alot and there are alot of answers on "how to resolve index.php issue in laravel".

However, I tried multiple ways in order to solve it from .htaccess on live dedicated server with WebsitePanel in order to remove index.php from URL. I tried a couple of ways however let me describe the issue here, index.php not only have changed the url, but also some of the css and javascript stuff are not loaded as well while most of them are loaded, CSS seems pretty fine but fonts are also changed.

It was working well at a shared host but here in a dedicated host it has alot of problems.

Is there a .htaccess code to solve this issue? and does index.php affects on CSS and is it normal?

my current htaccess is as follow:

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

RewriteEngine On

# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]

# Handle Front Controller...

Options +FollowSymLinks

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ /index.php [L]
</IfModule>
Kara
  • 6,115
  • 16
  • 50
  • 57
Akmal Arzhang
  • 357
  • 4
  • 14

3 Answers3

0

You don't need to modify index.php or .htaccess. If you did this, revert to original files.

To remove index.php or public from URLs, you need to setup virtual host for Laravel project (there are instructions both for nginx and apache).

After that restart web server.

Community
  • 1
  • 1
Alexey Mezenin
  • 158,981
  • 26
  • 290
  • 279
  • It is a dedicated live server, so is building virtual host practical on a liver server? to do so, what is the most common way? – Akmal Arzhang Jun 04 '16 at 14:09
  • It depends on web server you're using, if your website is working, just change document root and reboot web server (follow the link from my answer for instructions). – Alexey Mezenin Jun 04 '16 at 14:17
0

This is the most common problem in Laravel. When you upload your code to a webserver, your page will be in

 www.web-something.com/index.php

So there are 2 things you should do, 1.Change the .htaccess file and also 2.Change the Virtual Host Settings in your server. Link :for setting up a virtual host in apache

After this you will be able to visit the directory just fine. Also about the CSS , problem , Its probably because of the virtual host settings. Itll get fixed up once you point everything to the right directory.

Community
  • 1
  • 1
  • It is a dedicated live server, so is building virtual host practical on a liver server? to do so, what is the most common way? – Akmal Arzhang Jun 04 '16 at 13:57
0

For IIS Windows Server, the .htaccess needs to be translated to web.config and this works like a charm. here is the link: How to enable modrewrite on IIS Web Server

In case Someone needed this in future!

Akmal Arzhang
  • 357
  • 4
  • 14