I've been looking into hiding my web browser extentions as such http://www.mydomain.com/php-page/ without the need for .php or .html and if you try to add those extentions to "php-page" it will reply with page not found. Anyone know of this method, someone said it was a type of security.

VIPStephan

10-21-2012, 07:31 PM

The only security that is possibly added is that nobody will know what programming language and or server you are using by telling through the file extension. But generally this isn’t primarily done for security but for SEO reasons and is commonly known as “pretty URLs” or “search engine friendly URLs”.

There are two ways to do it, one that requires a change in the server configuration or .htaccess file and one that doesn’t but makes file management a little more laborious.

The second one goes like this: You create a dedicated directory for each page and put the actual HTML file as “index.html” (or index.php or whatever extension you have) in it. Browsers will always look for a file called index.* if no file name is provided. So the file structure would look like this:

You can then access the pages at http://example.com/about, for example, and it will load http://example.com/about/index.html automatically.
For the other – preferred – approach read this tutorial (http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/).

nx2b

10-21-2012, 11:51 PM

Thanks, so I'm currently using the code below in a .htaccess file and still nothing works, it's strange because I would go to the link without the extention and shows the page without structure. Not sure what's wrong.

That error, don't think had anything to do with css style, must of edited something in the htaccess.

VIPStephan

10-22-2012, 10:54 PM

I was going to approach this from the other way around, by looking at the paths generated by that rule and finding the issue in the CSS path. But if you really insist that someone just looks at your htaccess rule and tells you what’s wrong I can move the thread to the Apache Configuration forum.