[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

correct pretty URLs in .htaccess Apache


I have this URL:

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

I added some code but this URL doesn't work:

But this funny-looking URL works though:

So I know the program is working but how I can fix it so the URL works:

Just fyi, I was reading this page under the "Routing" section and just added that small tidbit of code:

I have this in my .htaccess file:

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

    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]

Open in new window

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

Thank you and Father bless<><
Victor Kimura
Victor Kimura
  • 2
  • 2
2 Solutions
you do not need a rewrite rule for the http://localhost/test/trunk/php/l4/public/users url to work if there is an index page in the public folder. just comment out the RewriteRule ^ index.php [L] and see
if there is a specific URL you need the /users URL to redirect. please post it here
Victor KimuraAuthor Commented:
@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.
as i do not understand your talk about frameworks and youtube which is absolutely irrelevant in your problem.
try this
Victor KimuraAuthor Commented:
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<><

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now