Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to hide file path in URL?

Tags:

url

php

filepath

What would be the best way to way to change my URL address to a custom one? Currently my website shows:

http://nkonecny.com/_pages/_portfolio/port.html

I want to change it to something like this:

http://nkonecny.com/portfolio
like image 319
Nick Avatar asked Aug 09 '11 16:08

Nick


3 Answers

You can use mod_rewrites.

Here is a good linux/apache tutorial

like image 76
Naftali Avatar answered Oct 07 '22 02:10

Naftali


.htaccess would be the best option.

http://httpd.apache.org/docs/1.3/howto/htaccess.html

like image 23
rackemup420 Avatar answered Oct 07 '22 02:10

rackemup420


mod_rewrite will do rewrites of this sort, but your pages have to follow a fairly strict naming/pathing convention for it to work. If you've got arbitrary path->names, then this won't work and you'll probably have to resort to a series of Apache 'Alias' directives.

like image 30
Marc B Avatar answered Oct 07 '22 03:10

Marc B