Click to See Complete Forum and Search --> : search engine friendly URL with database


mianriz
06-26-2005, 11:20 PM
Hi Programmers!
I want to change my database links into .html links, I read on net about .htaccess file that we can change our database link into simple statis links useing rewirte engine commands. please sort out my problem my links shows as http://www.efaisalabad.com/cat_sell.php?cid=27

in .htaccess file i use this method
RewriteEngine on
RewriteRule ^cat_sell(.*).html$ cat_sell.php?cid=$1

but its is not working please check and give me solution

I am waiting your quick responce

mianriz

vi5in
06-27-2005, 12:00 AM
RewriteBase /
RewriteEngine on
RewriteRule ^cat_sell([0-9]+)\.html$ cat_sell.php?cid=$1

But your's should also work.

What is it that isn't working?

chong
06-27-2005, 12:00 AM
hmmm, is your server apache?
or u may want to set your base directory first:
RewriteBase /mydir
for where the files are

chong
06-27-2005, 12:01 AM
Ah, vi5in beat me by seconds, hehe

mianriz
06-27-2005, 03:05 AM
Hi thanks
I use apachi server .htaccess file working fine but as i want to set my web daba base links its not working

I use your provided

RewriteBase /
RewriteEngine on
RewriteRule ^cat_sell([0-9]+)\.html$ cat_sell.php?cid=$1

but still same situation

please sort out

vi5in
06-27-2005, 04:46 AM
:) @ chong

What do you mean by "not working"?

Is it redirecting to the page at all? Because when I used this RewriteRule on my server, it worked fine: http://vivin.net/cat_sell27.html.

To get the value of cid, you need to use $_GET["cid"] in your PHP script.

Scleppel
06-27-2005, 06:48 AM
Is mod_rewrite enabled? You should ask your webhost or if your running your own server check if the LoadModule ... mod_rewrite line in your apache httpd.conf file is uncommented.

dera
06-28-2005, 05:48 AM
wrong forum buddy