Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-19-2009, 06:39 PM   PM User | #1
91local
New to the CF scene

 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
91local is an unknown quantity at this point
URL Rewriting using .htaccess and mod_rewrite php

I need help to rewrite my URL for better promotion.

My link is

http://www.domain.com/bb/cat_sell.php?cid=1

where cid=1 is Agriculture

Now i want url like this

http://www.domain.com/bb/category/Agriculture.html

and this is the ad posted in that category :

http://www.domain.com/bb/view_offer.php?id=37

I want url like this

http://www.domain.com/bb/selloffer/37/offername.html



I have web hosting with mod_rewrite on.

I tried using .htaccess file and placed in "bb" directory but it didn't change.

There is no such directory liek category or selloffer but i want it in the url.

Can any one help me the write process and what should be wirtten in .htaccess file.
91local is offline   Reply With Quote
Old 02-19-2009, 10:26 PM   PM User | #2
CyberPirate
Regular Coder

 
Join Date: Jan 2009
Location: Norway
Posts: 118
Thanks: 8
Thanked 2 Times in 2 Posts
CyberPirate is an unknown quantity at this point
First, is /bb/ a real directory? Because you are able to create fake directories with mod_rewrite. My example will be used in a file that is in public_html directory.

Code:
RewriteRule ^bb/category/agriculture.html*$ cat_sell.php?cid=1
With this rewrite rule can you now changed your dynamic link into

Code:
http://www.domain.com/bb/category/agriculture.htm
Hope this helped.
CyberPirate is offline   Reply With Quote
Old 02-25-2009, 08:33 AM   PM User | #3
91local
New to the CF scene

 
Join Date: Feb 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
91local is an unknown quantity at this point
Mod rewirte using htaccess

Quote:
Originally Posted by CyberPirate View Post
First, is /bb/ a real directory? Because you are able to create fake directories with mod_rewrite. My example will be used in a file that is in public_html directory.

Code:
RewriteRule ^bb/category/agriculture.html*$ cat_sell.php?cid=1
With this rewrite rule can you now changed your dynamic link into

Code:
http://www.domain.com/bb/category/agriculture.htm
Hope this helped.
ya bb is real directory it like this www.domain.com/bb/cat_sell.php

now all the categories are generated dynamically like for Agriculture cid = 1 my script creates as many ids.

as per above i have to write rewrite rule for each and every category.

can i have a single rewrite rule to take the cat-id automatically.

like for ex.

www.domain.com/bb/category/agriculture.html
www.domain.com/bb/category/handicraft.html

i have edited the code and its give me the link as below.

www.domain.com/bb/cat_sell.php?cname=Agriculture

cname can me many in my site..
91local is offline   Reply With Quote
Old 04-13-2009, 03:14 PM   PM User | #4
asifrasheed
New to the CF scene

 
Join Date: Apr 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
asifrasheed is an unknown quantity at this point
i need relly help
i want to change my url my url is
http://www.myname/index.php?id=1
http://www.myname/index.php?id=2
http://www.myname/index.php?id=3
http://www.myname/index.php?id=4 etc

i want to change it

http://www.myname/index.php/category/category name instead of id number
and its name is change at any time it is dynamic url.

pleade help me send me its coding
Thanks


Quote:
Originally Posted by CyberPirate View Post
First, is /bb/ a real directory? Because you are able to create fake directories with mod_rewrite. My example will be used in a file that is in public_html directory.

Code:
RewriteRule ^bb/category/agriculture.html*$ cat_sell.php?cid=1
With this rewrite rule can you now changed your dynamic link into

Code:
http://www.domain.com/bb/category/agriculture.htm
Hope this helped.
asifrasheed is offline   Reply With Quote
Old 12-26-2009, 06:17 AM   PM User | #5
mahesh
New to the CF scene

 
Join Date: Dec 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
mahesh is an unknown quantity at this point
URL Rewriting using .htaccess php

Hi All,
I need help to rewrite my URL for better promotion.

My link is

http://www.domain.com/pages.php?u=company

Now i want url like this

http://www.domain.com/company.html

Please help me.
mahesh is offline   Reply With Quote
Reply

Bookmarks

Tags
htaccess, mod_rewrite.php

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:16 AM.


Advertisement
Log in to turn off these ads.