Thread: Url

    #1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    299
    Rep Power
    9

    Url


    Good evening,

    I have a website using php to set the pages up. My URL is showing as: http://localhost/Gardenable/?page=home for example.

    How can I change it so that it displays as: http://localhost/Gardenable/Home ?

    Kind regards,

    NM.
    Last edited by Nanomech; July 27th, 2013 at 05:04 PM.
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,959
    Rep Power
    1014
    Hi,

    mapping URLs to files on the file system is the job of the web server, not of PHP. PHP comes into play after this has happened.

    You need to use the rewrite mechanism of your webserver (nginx, Apache or whatever).
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".
  4. #3
  5. Transforming Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,115
    Rep Power
    9398

    Preemptively moved from PHP


    I assume you're using Apache?
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2011
    Location
    The Pleiades
    Posts
    299
    Rep Power
    9
    Good morning all,

    I am indeed using Apache.

    I was told to add this:
    Code:
    RewriteEngine On
    RewriteCond %{REQUEST_URI} ^/Gardenable/$
    RewriteCond %{QUERY_STRING} ^page=([a-z]+)$
    RewriteRule ^(.*)$ http://localhost/Gardenable/%1 [R,L]
    but it gives a 'crossnetworking' error?

    Kind regards,

    NM.
  8. #5
  9. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    but it gives a 'crossnetworking' error?
    What is the actual text of the error?
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around

IMN logo majestic logo threadwatch logo seochat tools logo