Peter
Peter

Reputation: 151

hide url directory

I have a website:

www.mydomain.com/subfolder/subfolder/index.php

How could always hide the directory names from the url. I mean always hide the 2 subfolders' names from the url as the page changes.
Example:
These urls:

www.mydomain.com/subfolder/subfolder/index.php
www.mydomain.com/subfolder/subfolder/about.php
www.mydomain.com/subfolder/subfolder/contact.php
...

Becomes:

www.mydomain.com/index
www.mydomain.com/about
www.mydomain.com/contact
...

I want to use the last mentioned urls for requesting these pages, too, without typing a horrible long url.

Upvotes: 1

Views: 703

Answers (2)

Unsigned
Unsigned

Reputation: 9916

If you have access to the Rewrite engine, you can use a simple rewriting pattern similar to this:

RewriteRule ^/(.*)$ /subfolder/subfolder/$1.php

Upvotes: 1

bonny
bonny

Reputation: 3245

you can find some good hints when you will look for mod_rewrite or mod rewrite in htaccess.

Upvotes: 1

Related Questions