1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Removing .php extention

Discussion in 'Apache' started by SHT, May 10, 2006.

  1. #1
    I installed a phpBB search engine indexer mod which made an archive for my phpBB forum. It made the URLs look like this;

    xxxxx.net/archive/o_f__f_55____start_100__index.html

    Now, I recently upgraded to vBulletin and imported all my posts so all the thread ids were different etc. I've managed to make a script that re-directs users to the re-direct if they enter the site through that similar link. The only problem is the script only works if the format is

    xxxxx.net/archive.php/o_f__f_55____start_100__index.html (bold for emphasis)

    I know that it must be possible to made sure that the script works if you enter the site without the php extention. Any ideas?

    I've tried in /public_html/.htacess the following

    <files archive> 
    ForceType application/x-httpd-php 
    </files> 
    Code (markup):
    with and without .php extention. I got that code from searching for "removing .php extention .htacess". I'm using apache.

    Cheers.
     
    SHT, May 10, 2006 IP
  2. ResaleBroker

    ResaleBroker Active Member

    Messages:
    1,665
    Likes Received:
    50
    Best Answers:
    0
    Trophy Points:
    90
    #2
    Try "Options MultiViews" in .htaccess. ;)
     
    ResaleBroker, May 10, 2006 IP
  3. SHT

    SHT Active Member

    Messages:
    266
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    73
    #3
    Thanks for the quick reply. I've just tried that but I still get a 404 error when trying to access;
    xxxxx.net/archive/o_f__f_55____start_100__index.html

    xxxxx.net/archive.php/o_f__f_55____start_100__index.html works fine though.
     
    SHT, May 10, 2006 IP
  4. Sythe

    Sythe Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    If you have modrewrite installed you could try something like:

    RewriteEngine On
    RewriteBase /

    RewriteCond %{REQUEST_URI} !(archive.php$)
    RewriteRule ^archive/(.*) archive.php/$1 [L,NC]

    Not quite sure if the above will work straight off since I havent tested it. If you need help lookup the apache documentation for mod rewrite.
     
    Sythe, May 10, 2006 IP
  5. livingearth

    livingearth Well-Known Member

    Messages:
    1,469
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    140
    #5
    Try adding this to your .httaccess file.

    <Files archive>
    ForceType application/x-httpd-php
    AcceptPathInfo On
    </Files>


    and remove the extension from the file "archive.php" so it is actually named "archive". That is if you haven't already done so...

    This works on my server..

    Let me know if it helps you out.
     
    livingearth, May 10, 2006 IP
  6. SHT

    SHT Active Member

    Messages:
    266
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    73
    #6
    I tried doing that, renaming archive.php to archive then adding;

    but when I try access the xxxxx.net/archive/o_f__f_55____start_100__index.html type of URLs, I get a server error. So i commented out the AcceptPathInfo On and that fails to load anything.

    Cheers for the help.
     
    SHT, May 11, 2006 IP
  7. livingearth

    livingearth Well-Known Member

    Messages:
    1,469
    Likes Received:
    83
    Best Answers:
    0
    Trophy Points:
    140
    #7
    does "archive" redirect?
    is index.html an actual file in this case?
     
    livingearth, May 11, 2006 IP
    SHT likes this.
  8. SHT

    SHT Active Member

    Messages:
    266
    Likes Received:
    21
    Best Answers:
    0
    Trophy Points:
    73
    #8
    I got it working; I took out some other things from my .htaccess and re-tried what you told me and it works.

    Cheers for the help +green.
     
    SHT, May 11, 2006 IP