Welcome to WebDesignForums.net!
You're currently viewing WDF as a guest. By registering for a free account, you'll be able to participate with other members in our friendly community. Being a member allows you to ask questions and get answers for those troublesome web development tasks!

In addition, as a member you'll be able to post your websites up for review. Using our unique website review system you can gain some amazing feedback from some of the best web developers around. This is a completely free service to all registered members.

Ready to register yet? Registration is 100% free. Click Here To Join Now!

PHP site - switching from query params to paths

Discussion in 'Server Administration Help' started by raspberryh, Feb 28, 2012.

  1. Offline

    raspberryh Member

    Message Count:
    882
    Likes Received:
    1
    Trophy Points:
    18
    Gender:
    Female
    Location:
    Erie, PA
    Hi guys,

    I'm not sure if I am posting this in the right section, so sorry in advance if this is the wrong place :-P

    There's a website where every single page is at index.php?page=about or index.php?page=contact. For SEO purposes, I'd like to convert it to be at /about, /contact, etc.

    I would still like the main handler to be 1 specific file, and it could do different things based on the parts of the path.

    This was really easy to do in AppEngine, I guess it is built-in. But I can't figure out how I would do this in just a regular PHP site. I mean if the website URL is www.example.com/about, won't the server look for the directory /about? How can I make it not look for the /about directory and instead just hand the request over to index.php? (Or some specific php file)

    Thanks!
    Heather


  2. Offline

    Webzarus Well-Known Member

    Message Count:
    3,003
    Likes Received:
    666
    Trophy Points:
    113
    Gender:
    Male
    Is this for the WP project you've been working on ??

    If so, there is a setting within the WP section to turn that on if the server that it's on had the apache mod-rewrite module turned on...

    If not for WP... And the sites is on a Linux server, then you can usually accomplish the same thing with an .htaccess rule. You can search the forums for specifics on that... I know I've seen it answered several times...

    If you're on a windows server... Sorry... I believe server 2008 supports something similar... But it's a major pain.


    raspberryh likes this.
  3. Offline

    raspberryh Member

    Message Count:
    882
    Likes Received:
    1
    Trophy Points:
    18
    Gender:
    Female
    Location:
    Erie, PA
    Hi,

    Thanks for the reply! No it's not for the WP project, I am pretty sure this site is not in WP (but I have not been given the FTP info for it yet).

    I will try to find the info on the htaccess rule... but it's hard to figure out the correct terms to search for...

    Thanks again,
    Heather


  4. Offline

    raspberryh Member

    Message Count:
    882
    Likes Received:
    1
    Trophy Points:
    18
    Gender:
    Female
    Location:
    Erie, PA
  5. Offline

    Webzarus Well-Known Member

    Message Count:
    3,003
    Likes Received:
    666
    Trophy Points:
    113
    Gender:
    Male
    That should work... Personally, I've been using windows based servers since NT, just recently setup and running a Linux server with apache... Wow!!! What have I been missing all these years ?

    Now I just gotta find an extra 4-6 hours a day to play catch up.


    AlphaMare and raspberryh like this.

Share This Page