Old 04-09-2006, 08:19   #1 (permalink)
Limbo
Bask
 
Limbo's Avatar
 
Join Date: Feb 2005
Posts: 5,175
Using .htaccess to change url file extensions

Hi Folks - is there a an easy way for me to rewrite the following

www.example.com/thing.php

to

www.example.com/thing

??

I did a search or two but couldn't find a consistent method. I have used a folder named thing with an index.php file before now, but need a cleaner method for an indexed site that needs some careful SEO.

Cheers, Limbo

Last edited by Limbo : 04-09-2006 at 10:23. Reason: Better title for SEO
  Reply With Quote
Old 04-09-2006, 08:26   #2 (permalink)
Limbo
Bask
 
Limbo's Avatar
 
Join Date: Feb 2005
Posts: 5,175
Found a simple one for simple .php removal:

Code:
RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA]
  Reply With Quote
Old 04-09-2006, 08:27   #3 (permalink)
lukasarts
Shiv.
 
lukasarts's Avatar
 
Join Date: Jul 2006
Location: Elsewhere
Posts: 1,109
For Apache: URL rewriting
  Reply With Quote
Old 04-09-2006, 08:35   #4 (permalink)
mx
fucksocks™
 
mx's Avatar
 
Join Date: Jun 2005
Location: in the boosh
Posts: 1,615
Code:
RewriteEngine On RewriteRule ^([A-Za-z0-9\+]+)/?$ $1.php


that should do it. but have a play.

I've found this cheatsheet pretty useful for getting your head round the basics.
__________________
  Reply With Quote
Old 04-09-2006, 10:22   #5 (permalink)
Limbo
Bask
 
Limbo's Avatar
 
Join Date: Feb 2005
Posts: 5,175
Cheers - I'll use the one I have, but this page has made a good bookmark
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8