Jump to content

Using URL Rewriting / .htaccess


lbh2011

Recommended Posts

Hello,

 

Could anyone point me in the right direction with regards to URL Rewriting.

 

I have a site e.g. www.domain.com

 

This site has a subdirectory which runs a membership script e.g. www.domain.com/membership

 

Almost all of the functions of the membership script are handled by one file e.g. www.domain.com/membership/process.php

 

Functions occur when different variables are passed to the script e.g. www.domain.com/membership/process.php?update will show a form where users can update their details.

 

What I would like to do is to rewite the URL so that users can access process.php and it's functions via www.domain.com/process.php instead of www.domain.com/membership/process.php

 

Is this possible using .htaccess?

 

I did try to do the above by adding <?php include'membership/process.php?update'; ?> to www.domain.com/process.php but this doesn't work as variables are not passed!

 

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/268585-using-url-rewriting-htaccess/
Share on other sites

Even if the script is at /process.php it still needs to know whether to update or something else.

 

If you're still passing that in the URL like

www.example.com/process.php?update

then all you need* in /process.php is

The real script will still have $_GET and $_POST like it normally would.

 

 

But a question: how about just moving the file? Does it really need to be in two places?

 

 

* Probably. There are a few reasons why you might need something else.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.