0

I am currently making my own CMS for a project I'm working on, and I saw in a different CMS it had the url as http://localhost/home but the file path was htdocs/app/tpl/skins/skinname/home.php I was wondering how I can do this, I know how to take the .PHP off the file, but how did it take the folder path off?

  • send all requests to index.php at the http server, then route those requests to a file. – Ryan Jul 23 '14 at 18:22
  • 1
    Did you try googling this? This is the third result: http://stackoverflow.com/questions/1885993/change-url-address-make-short-in-php – danronmoon Jul 23 '14 at 18:22

1 Answers1

0

If you have the ability to use mod_rewrite in your .htaccess file, I would do this:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteRule ^home/$ htdocs/app/tpl/skins/skinname/home.php [L]
</IfModule>

This tells it that anything like {domain}/home/ should actually be directed to {domain}htdocs/app/tpl/skins/skinname/home.php while still preserving the intended {domain}/home/ URL in the browser's address bar.

alanine
  • 121
  • 5