Go Back   CodingForums.com > :: Server side development > Apache configuration

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 04-08-2010, 04:32 AM   PM User | #1
Joseph Witchard
Regular Coder

 
Join Date: Oct 2008
Posts: 255
Thanks: 113
Thanked 0 Times in 0 Posts
Joseph Witchard is an unknown quantity at this point
No File Extensions on URLs

How do you remove them? I remove them with the following code (using mod_rewrite):

Code:
^(somepage|someotherpage)/?$ /$1\.php
But, I've heard there's a more efficient way to do it. What is it?
Joseph Witchard is offline   Reply With Quote
Old 04-09-2010, 03:04 PM   PM User | #2
angst
Senior Coder

 
angst's Avatar
 
Join Date: Apr 2004
Location: Toronto, Ontario
Posts: 2,112
Thanks: 15
Thanked 122 Times in 122 Posts
angst is on a distinguished road
you method looks ok to me,

but there are a few ways to do this;

PHP Code:
RewriteEngine on
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteCond 
%{REQUEST_FILENAME}.html -f
RewriteRule 
^(.*)$ $1.html 
PHP Code:
RewriteEngine On
RewriteCond 
%{REQUEST_FILENAME} !-f
RewriteCond 
%{REQUEST_FILENAME} !-d
RewriteRule 
^(.*)$ index.php?q=$[L,QSA
angst is offline   Reply With Quote
Old 04-12-2010, 05:47 AM   PM User | #3
Joseph Witchard
Regular Coder

 
Join Date: Oct 2008
Posts: 255
Thanks: 113
Thanked 0 Times in 0 Posts
Joseph Witchard is an unknown quantity at this point
Would you mind explaining each line to me? I don't mean to be an annoyance, but I've only ever done a couple of things on .htaccess, so it's still very new to me.
Joseph Witchard 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 10:03 AM.


Advertisement
Log in to turn off these ads.