Skip to content

Instantly share code, notes, and snippets.

@danilobatistaqueiroz
Last active November 6, 2017 02:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danilobatistaqueiroz/d046cdb1ba5f42e69b6bcaace9e2043a to your computer and use it in GitHub Desktop.
Save danilobatistaqueiroz/d046cdb1ba5f42e69b6bcaace9e2043a to your computer and use it in GitHub Desktop.
Rewrite urls on subdirectories on apache

Rewriting Urls on Apache2

Supose you have a directory structure like that:

directories

and on httpd.conf you have:

DocumentRoot c:\www

to access user.php you'll use: http://localhost/simpleblog/rest/user.php

to use something like: http://localhost/simpleblog/user

!!!Trying to find a good solution


At the folder of an index.php page of a framework like CodeIgniter or Laravel,
you can use the url without specifying the index.php:
instead of http://localhost/sitex/index.php
with the .htaccess above you can type: http://localhost/sitex/

RewriteEngine On  
RewriteRule ^(.*)$ index.php [NC,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment