Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-21-2012, 06:32 PM   PM User | #1
nx2b
New Coder

 
Join Date: Aug 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
nx2b is an unknown quantity at this point
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.
nx2b is offline   Reply With Quote
Old 10-21-2012, 07:31 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-21-2012, 11:51 PM   PM User | #3
nx2b
New Coder

 
Join Date: Aug 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
nx2b is an unknown quantity at this point
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
nx2b is offline   Reply With Quote
Old 10-22-2012, 01:38 AM   PM User | #4
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
What do you mean by “without structure”? Without styles? Do you have a link for us?
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-22-2012, 04:34 AM   PM User | #5
nx2b
New Coder

 
Join Date: Aug 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
nx2b is an unknown quantity at this point
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.
nx2b is offline   Reply With Quote
Old 10-22-2012, 12:40 PM   PM User | #6
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
Then please post your HTML code and tell us where your CSS file is located in the directory tree.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 10-22-2012, 07:35 PM   PM User | #7
nx2b
New Coder

 
Join Date: Aug 2012
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
nx2b is an unknown quantity at this point
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.
nx2b is offline   Reply With Quote
Old 10-22-2012, 10:54 PM   PM User | #8
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,600
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:54 AM.


Advertisement
Log in to turn off these ads.