Page 1 of 1
PHP url querystring question
Posted: Fri Feb 29, 2008 1:59 pm
by eektech909
My boss doesn't like seeing the question mark in the url.
I explained how a querystring works but he's set in his ways.
I'd rather not create a bunch of folders with index files in each.
He doesn't want
http://www.example.com/?cat=one
http://www.example.com/?cat=two
Instead, he wants
http://www.example.com/one/
http://www.example.com/two/
Any way to do this?
Re: PHP url querystring question
Posted: Fri Feb 29, 2008 2:14 pm
by Peter Anselmo
You can do it with Apache's mod_rewrite module. I'd suggest Googling it to get the whole rundown.
Re: PHP url querystring question
Posted: Fri Feb 29, 2008 2:24 pm
by PrObLeM
You can also do it in the .htaccess file
I'm pretty sure this will work
Code: Select all
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^/(.+) /?cat=$1
Re: PHP url querystring question
Posted: Fri Feb 29, 2008 3:58 pm
by eektech909
I did some research and this is exactly what I am looking for. I contacted our hosting company about the .htaccess files.
I'm not very familiar with this.
Can I create an .htaccess file with this in it via text edit and drop it in the folder of the index.php?
Re: PHP url querystring question
Posted: Fri Feb 29, 2008 5:12 pm
by hawkenterprises
Believe it or not there is an entire website and community devoted to this question
http://www.modrewrite.com/
I will say this though, if you are going to be doing 100k+ rewrites apache mod all though fast will take it's toll in performance, I would recommend a file based or combination solution to reach alot of pages/traffic.
Re: PHP url querystring question
Posted: Tue Mar 04, 2008 1:03 pm
by eektech909
Alright...
We don't personally host the site, but I guess we're running an IIS server.
We had ISAPI_Rewrite 3 Installed
Here's what i'm trying to convert
http://www.exampled.com/download/?cat=one
I made a txt file with the above code and renamed it to .htaccess and uploaded it to the directory but its not working
???