Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 6 of 6

Thread: le htaccess

  1. #1
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default le htaccess

    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.php -f
    RewriteRule ^(.*)$ $1.php

    That takes off the .php from filenames, so it is now www.site.com/index how can I make it so it's www.site.com/site/index

  2. #2
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Sorry for the bump, but this is urgent. ^_^

  3. #3

    Default

    Personally what I think you should do is rewrite all urls to one point of entry e.g. index.php and from there find if the page requested exists and if it doesn't give them a nice error.

    But onto what you wanted, if you want to rewrite only urls that are in the form of /site/file to file.php then this is what you want
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^site/([^/\.]+)/?$ $1.php
    This will rewrite the urls as stated with the optional trailing slash but this will not rewrite urls in the form of /site/folder/file to folder/file.php, if this is what you want you can use the following.

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^site/(.*?)$ $1.php
    This will rewrite urls in the form of /site/folder/file or /site/folder/subfolder/file etc to folder/file.php or folder/subfolder/file.php. You can also add your follow sym links or what not.

    Enjoy!

  4. #4
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Thanks a lot. +rep
    Last edited by wsg14; 07-11-2008 at 03:53 AM.

  5. #5
    Join Date
    May 2008
    Posts
    1,160
    Tokens
    11

    Latest Awards:

    Default

    Quote Originally Posted by Iszak View Post
    Personally what I think you should do is rewrite all urls to one point of entry e.g. index.php and from there find if the page requested exists and if it doesn't give them a nice error.

    But onto what you wanted, if you want to rewrite only urls that are in the form of /site/file to file.php then this is what you want
    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^site/([^/\.]+)/?$ $1.php
    This will rewrite the urls as stated with the optional trailing slash but this will not rewrite urls in the form of /site/folder/file to folder/file.php, if this is what you want you can use the following.

    Code:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    
    RewriteRule ^site/(.*?)$ $1.php
    This will rewrite urls in the form of /site/folder/file or /site/folder/subfolder/file etc to folder/file.php or folder/subfolder/file.php. You can also add your follow sym links or what not.

    Enjoy!
    Haha. You always post such long, well explained, & helpful posts. +REP

    EDIT: Gotta spread, soz
    Previously a Habbo fanatic, web designer/developer, fansite owner, & trusted member of the community.

  6. #6

    Default

    It saves the person who was misinformed on my behalf from posting another message and waiting hours to days for another reply. So I post a lengthy one that will be sure to satisfy their needs. Thanks for the rep+ both of you.

Posting Permissions

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