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 03-22-2012, 09:36 PM   PM User | #1
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 794
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
Fake extension

I'm wondering, is it possible to create a fake extension for a file? E.g if a user goes to mysite.com/index.go it actually load index.php but the URL bar will still say index.go?
tomharto is offline   Reply With Quote
Old 05-13-2012, 01:22 PM   PM User | #2
Techyonomics
New Coder

 
Join Date: May 2012
Location: Mars
Posts: 11
Thanks: 1
Thanked 0 Times in 0 Posts
Techyonomics is an unknown quantity at this point
Yeah Just put this in your .htaccess file
Code:
AddType application/x-httpd-php .php .phtml .php3 .go
Techyonomics is offline   Reply With Quote
Old 05-14-2012, 10:30 AM   PM User | #3
DJCMBear
Senior Coder

 
DJCMBear's Avatar
 
Join Date: Mar 2010
Location: United Kindom
Posts: 1,173
Thanks: 14
Thanked 136 Times in 136 Posts
DJCMBear is on a distinguished road
Or a second option would be to have something like this
Code:
RewriteEngine On
RewriteRule (.+)\.go /$1.php
__________________
Official BinPress hand picked coder.
For anyone worried about SQL injection go have a look at my small yet powerful script here.
Go Pledge for Light Table, if it hit's $300,000 Python and other languages will get added.
I am 1 of 65,608 people to get a Pebble Watch :P
DJCMBear is offline   Reply With Quote
Old 05-23-2012, 10:14 AM   PM User | #4
tomharto
Regular Coder

 
Join Date: Jul 2010
Location: Sheffield
Posts: 794
Thanks: 91
Thanked 18 Times in 18 Posts
tomharto is on a distinguished road
Code:
RewriteEngine On
RewriteRule (.+)\.go /$1.php
That's way I wanna go, I don't actually want .go files I just want the URL to show that. However when i added this the .go files sent me to the root dir. The .go files are at a URL 'locahost/Dropbox/eg/new/index.go/' but they load the same page as just 'localhost'. Anyone know why it's doing that?

EDIT: It works if I put the .htaccess file in the root folder not the sub dir one .

However now i have a new question haha.

Code:
RewriteRule (.+)\.login /$1/login.php
I need that rule to ignore the filename and just use the folders, so /sub1/sub2/index.login would actually load /sub1/sub2/login.php. Obviously atm its loading /sub1/sub2/index/login.php. I need it to ignore the filename, is that possible?

EDIT 2: I came up with this "RewriteRule (.+)/(.+)\.login $1/login.php" Is that a good way to do it or could that be better?

Last edited by tomharto; 05-23-2012 at 12:37 PM..
tomharto 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 06:19 PM.


Advertisement
Log in to turn off these ads.