The Lodge is members-only design/dev videos and Office Hours.

Next Office Hours Session: "Implementing an SVG Icon System" Nov 30 - 6:00 PM Eastern

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.

    # October 26, 2010 at 5:10 am

    You could have a look here :D

    Is that helpful? :)

    # 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

    This reply has been reported for inappropriate content.

    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

    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

    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:
    I cant make a file with a “?”. Thats my problem..


    # September 21, 2012 at 9:19 pm

    This reply has been reported for inappropriate content.

    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.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed