Grow your CSS skills. Land your dream job.

removing ? and = from php get method.

  • # October 26, 2010 at 4:22 am

    i was wondering how to remove the question mark and the equal sign from the url when using the get method example:
    http://mysite/test.php?city=canada i want it to be like this http://mysite/test.php-city-canada either using dash or something of my choice, i think this could be done on .htaccess but i just haven’t found any example online or a way.

    Rob
    # October 26, 2010 at 5:10 am

    You could have a look here :D

    http://net.tutsplus.com/tutorials/other/using-htaccess-files-for-pretty-urls/

    Is that helpful? :)

    Bob
    # October 26, 2010 at 5:21 am

    Or use the post method, which won’t show anything in your urls :)

    # November 3, 2010 at 4:03 pm

    ah, but then you can’t bookmark those pages Bob.

    A rewrite rule like:
    RewriteRule ([a-zA-Z]+)/([a-zA-Z]+)/([a-zA-Z]+)$ $1.php?$2=$3

    would (I believe, I haven’t tested it) let you turn
    http://mysite/test/city/canada
    into
    http://mysite/test.php?city=canada

    if you were wedded to using dashes instead of slashes, it would probably be something like
    RewriteRule ([a-zA-Z]+)-([a-zA-Z]+)-([a-zA-Z]+)$ $1.php?$2=$3

    giving a possible link of
    http://mysite/test-city-canada

    That should work. Does anyone see any goofs I’ve made?

    To really understand it though, look over Robskiwarrior’s link. It’s where I actually got most of this info from.

    # November 4, 2010 at 6:06 am

    @WCMiller yeah post seems not to be my option, let me try that and i will get back once i’ve tried this…

    # September 21, 2012 at 1:50 pm

    Hey I have an html website on my computer and I want to make files for each search. i dont have .htaccess. Is there another way I can do it???

    Please HELP

    example: search”syberfx”
    search url:http://example.com/?=syberfx
    I cant make a file with a “?”. Thats my problem..

    PLEASE HELP!!
    Thanks

    # September 21, 2012 at 9:19 pm

    This thread is almost two years old. Are you trying to contribute to that conversation, or do you have a new question?

    If you’re asking your own question, you should start a new thread instead of posting a comment in this one.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".