CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   General web building (http://www.codingforums.com/forumdisplay.php?f=10)
-   -   Web browser file extenstions (http://www.codingforums.com/showthread.php?t=278536)

nx2b 10-21-2012 06:32 PM

Web browser file extenstions
 
Hi,

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:
Code:

index.html – this is the site’s home page
/about
  index.html
/contact
  index.html


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.

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.

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+_?[a-z]+)/$ /$1.php


VIPStephan 10-22-2012 01:38 AM

What do you mean by “without structure”? Without styles? Do you have a link for us?

nx2b 10-22-2012 04:34 AM

Yeah without style, no I do not it's local testing, what would be the "code" for rewriting my pages is what I have so far sufficient? Please give me your input.

VIPStephan 10-22-2012 12:40 PM

Then please post your HTML code and tell us where your CSS file is located in the directory tree.

nx2b 10-22-2012 07:35 PM

I thought you could help me edit my settings so far.

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^([a-z]+_?[a-z]+)/$ /$1.php

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.

Try commenting out the FollowSymLinks rule and see what happens.


All times are GMT +1. The time now is 03:25 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.