Jump to content
The Uniform Server Community

.htaccess to turn /page into /page.php?


PdV
 Share

Recommended Posts

Hi gang,

 

I've had a website developed for me which has a shop element to it.

 

On the developers' server I access the shop using http://www.mainsite.com/shop but on my server I have to use http://www.mainsite.com/shop.php.

 

I would rather use the former and my request to the developers has met with them giving me a .htaccess file to put in the root folder of my site. however whe I do noone has any access to any part of the site.

 

I've complained to the developers but the reply I got was 'it works on our server'...and that's it!

 

Needless to say I've got some issues brewing with the developers, but I won;t go into that now.

 

Basically, can someone who knows lots more about this than me have a quick look at the .htaccess file they've provided and perhaps give me some pointers as to how to make it work on uniformserver, please?

 

The contents of the file is:

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)$ $1.php?id=$2 [L,QSA]

 

Cheers,

Paul

Link to comment
Share on other sites

What they have supplied looks Ok

 

The only thing I think is missing is:

 

Options +FollowSymLinks

 

Add that to the above lines of code they supplied.

 

For a real good ramble take a look at

http://center.uniformserver.com/new_users_...te_1_intro.html

 

It’s one of my tutorials that may shed light on the problem

 

All the best

Ric :)

Link to comment
Share on other sites

Thanks Ric.

 

I've added the line you gave and users now have access to the site, however it still doesn't take me to the shop when I type just /shop rather than /shop.php.

 

Any ideas why this would be?

 

I'm running US 3.5 Apollo and haven't made any changes other than userid/password and enabling curl.

 

Many thanks,

Paul.

Link to comment
Share on other sites

I keep looking at this line:

 

On the developers' server I access the shop using http://www.mainsite.com/shop but on my server I have to use http://www.mainsite.com/shop.php.

 

I get the impression your shop files are in the root folder www but should be in www/shop!

 

1) On the developers' server I access the shop using http://www.mainsite.com/shop

This to works because Apache assumes “shop” is a folder lack of a file extension and effectively adds a slash at the end to give http://www.mainsite.com/shop/

 

It now looks in folder shop for a file named index.php this probably redirects to shop.php a executes your shop script.

 

2) I have to use http://www.mainsite.com/shop.php in this case Apache sees a file extension and looks in the root folder www for it.

 

Try this use http://www.mainsite.com/index.php if it works I would think your files are probably in the wrong folder.

 

If your set-up is correct you could always create a folder shop and place a script in it named index.php and redirect to http://www.mainsite.com/shop.php

 

Just a thought

 

All the best

Ric :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...