Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Aug 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts

    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.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    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.

  • #3
    New Coder
    Join Date
    Aug 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #4
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    What do you mean by “without structure”? Without styles? Do you have a link for us?

  • #5
    New Coder
    Join Date
    Aug 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    Then please post your HTML code and tell us where your CSS file is located in the directory tree.

  • #7
    New Coder
    Join Date
    Aug 2012
    Posts
    16
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •