URL ReWriting Problem?

Thread Solved

Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

URL ReWriting Problem?

 
0
  #1
Jan 22nd, 2009
Hello there...

Any body help me to fix this problem regarding .htaccess

I have written this code to convert my url from .php to .html
  1. RewriteEngine on
  2. RewriteRule shopping/leftproducts/([^/]+).html$ /shopping/leftproducts.php?c_id=$1 [L]
but this couldn't work for me...
i coundn't find where the problem occurs..

My url is like :
  1. www.something.com/shopping/leftproducts.php?c_id=5

please solve my problem

Thanks In Advance
Shanti.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: URL ReWriting Problem?

 
-1
  #2
Jan 22nd, 2009
hello there...
please help on this.....
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: URL ReWriting Problem?

 
0
  #3
Jan 26th, 2009
hello..
anybody please help on this...
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 252
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: URL ReWriting Problem?

 
0
  #4
Jan 26th, 2009
OK then,
Try this:
  1. RewriteEngine on
  2. RewriteRule ^shopping/leftproducts/([A-Za-z0-9]).html$ /shopping/leftproducts.php?c_id=$1 [L, QSA]
I will explain the bits of this for you
1stly you need to put the ^ charictar at the start of the string to redirect not just the wildcard

2ndly you should realy just set your variable section to a selection of leters, the way you had it if anyone was smart enough they could enter something like:
  1. /shopping/leftproducts/C:/private_stuff/mybankdetails.doc
And pull up all your lovely private information. The way it is set up there it will redirect
  1. shopping/leftproducts/page.html,
  2. shopping/leftproducts/bob.html,
  3. shopping/leftproducts/margret.html
But not
  1. shopping/leftproducts/bob/dog/smily_face.html

I have also added the QSA flag wich is query string append (Or ammend or something ) so
  1. shopping/leftproducts/page.html?Do=Make a cup of tea
would call
  1. /shopping/leftproducts.php?c_id=page&Do=Make a cup of tea
Any more probs just say (I havent tested this so not 100% sure it will work)
Regards,
Sam RUdge
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: URL ReWriting Problem?

 
0
  #5
Jan 27th, 2009
very very thanks for your input....

I got this error:
  1. 500 Internal Server Error
  2.  
  3. The request was not completed. The server met an unexpected condition.
  4.  
  5. something/mysite/shopping/leftproducts.php?c_id=5 (port 80)
  6.  
  7. Please forward this error screen to 74.53.25.162's WebMaster.
  8.  

im my site i have a folder like shopping..and my leftproducts.php is in shopping folder..but index page is our side of shopping folder..
then where should i placed this .htaccees file....

thank again
waiting for your reply...
Last edited by Shanti Chepuru; Jan 27th, 2009 at 3:14 am.
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 252
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: URL ReWriting Problem?

 
0
  #6
Jan 27th, 2009
.htaccess files can go in any directory but if you are putting your rewrites in a .htaccess you should have it in the topmost directory. However you can put it anywhere you like as long as the links are relative E.G. you might be better off changing your rewrite rule to
  1. RewriteEngine on
  2. RewriteRule ^leftproducts/([A-Za-z0-9]).html$ leftproducts.php?c_id=$1 [L, QSA]
Now place your .htaccess file in the shopping directory.
I am presuming you access /shopping/ from
http://yoursite.com/shopping/
so you should get the page at
http://yoursite.com/shopping/leftproducts/page.html
Hope this helps
Sam Rudge
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: URL ReWriting Problem?

 
0
  #7
Jan 27th, 2009
thanks again for your reply...
i got the same error after i tried as you directed...

please give more inputs on this..
thank you..
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,352
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is offline Offline
Nearly a Posting Virtuoso

Re: URL ReWriting Problem?

 
1
  #8
Jan 27th, 2009
have you determined that mod_rewrite is enabled in your server
500 Internal server error often means the module is not compiled in
Failure is not an option It's included free, you don't have to do anything to get it
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it

Please mark solved problems, solved
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,073
Reputation: Shanti Chepuru is on a distinguished road 
Solved Threads: 98
Shanti Chepuru's Avatar
Shanti Chepuru Shanti Chepuru is offline Offline
Veteran Poster

Re: URL ReWriting Problem?

 
0
  #9
Jan 27th, 2009
thanks bob...
how to know that is enabled or not...
if not how to enable it????
Be intelligent, But Don't try to cheat.. Be innocent But Don't get cheated..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 252
Reputation: samarudge is an unknown quantity at this point 
Solved Threads: 20
samarudge samarudge is offline Offline
Posting Whiz in Training

Re: URL ReWriting Problem?

 
1
  #10
Jan 27th, 2009
Hmm, it dont look like a missing module in apache as the error outputs the redirect URL
  1. something/mysite/shopping/leftproducts.php?c_id=5
Try asking your webhost but other than that im stumped, sorry
My Blog, Life and everything that matters to me - SamRudge.co.uk

2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC