Link to home
Start Free TrialLog in
Avatar of Victor Kimura
Victor KimuraFlag for Canada

asked on

correct pretty URLs in .htaccess Apache

Hi,

I have this URL:
http://localhost/test/trunk/php/l4/public/index.php

and it works fine. I'm using Laravel 4 btw.

I added some code but this URL doesn't work:
http://localhost/test/trunk/php/l4/public/users

But this funny-looking URL works though:
http://localhost/test/trunk/php/l4/public/index.php/users

So I know the program is working but how I can fix it so the URL works:
http://localhost/test/trunk/php/l4/public/users

Just fyi, I was reading this page under the "Routing" section and just added that small tidbit of code:
http://laravel.com/docs/quick#installation

I have this in my .htaccess file:

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

    RewriteEngine On
    RewriteBase /

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

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

Open in new window


How can I fix it to make this work in .htaccess?

Thank you and Father bless<><
SOLUTION
Avatar of theruck
theruck
Flag of Slovakia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Victor Kimura

ASKER

@theruck, if I comment out the RewriteRule then don't I need to comment out the RewriteCond's too since it's the rule based on the previous conditions and it's the last rule?

It's the Lararel framework so there is no public/users folder. I don't know the inner workings of the framework but it's supposed to work. The youtube videos I've seen have used a Vagrant box for it so maybe it'll work then.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Also, what worked for me was that I had to enable the mod_rewrite in Apache because by default it's not enabled for WAMP which is odd I think since it's so widely used. But then I had to restart my computer or log out and then log back in again because it's tied to the Windows session. Hope this helps others too. Father God bless<><