| | |
URL ReWriting Problem?
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
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
but this couldn't work for me...
i coundn't find where the problem occurs..
My url is like :
please solve my problem
Thanks In Advance
Shanti.
Any body help me to fix this problem regarding .htaccess
I have written this code to convert my url from .php to .html
PHP Syntax (Toggle Plain Text)
RewriteEngine on RewriteRule shopping/leftproducts/([^/]+).html$ /shopping/leftproducts.php?c_id=$1 [L]
i coundn't find where the problem occurs..
My url is like :
PHP Syntax (Toggle Plain Text)
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..
•
•
Join Date: May 2008
Posts: 246
Reputation:
Solved Threads: 19
OK then,
Try this:
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:
And pull up all your lovely private information. The way it is set up there it will redirect
But not
I have also added the QSA flag wich is query string append (Or ammend or something
) so
would call
Any more probs just say (I havent tested this so not 100% sure it will work)
Regards,
Sam RUdge
Try this:
PHP Syntax (Toggle Plain Text)
RewriteEngine on RewriteRule ^shopping/leftproducts/([A-Za-z0-9]).html$ /shopping/leftproducts.php?c_id=$1 [L, QSA]
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:
PHP Syntax (Toggle Plain Text)
/shopping/leftproducts/C:/private_stuff/mybankdetails.doc
PHP Syntax (Toggle Plain Text)
shopping/leftproducts/page.html, shopping/leftproducts/bob.html, shopping/leftproducts/margret.html
PHP Syntax (Toggle Plain Text)
shopping/leftproducts/bob/dog/smily_face.html
I have also added the QSA flag wich is query string append (Or ammend or something
) so PHP Syntax (Toggle Plain Text)
shopping/leftproducts/page.html?Do=Make a cup of tea
PHP Syntax (Toggle Plain Text)
/shopping/leftproducts.php?c_id=page&Do=Make a cup of tea
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 =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
very very thanks for your input....
I got this error:
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...
I got this error:
PHP Syntax (Toggle Plain Text)
500 Internal Server Error The request was not completed. The server met an unexpected condition. something/mysite/shopping/leftproducts.php?c_id=5 (port 80) Please forward this error screen to 74.53.25.162's WebMaster.
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..
•
•
Join Date: May 2008
Posts: 246
Reputation:
Solved Threads: 19
.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
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
PHP Syntax (Toggle Plain Text)
RewriteEngine on RewriteRule ^leftproducts/([A-Za-z0-9]).html$ leftproducts.php?c_id=$1 [L, QSA]
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 =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
have you determined that mod_rewrite is enabled in your server
500 Internal server error often means the module is not compiled in
500 Internal server error often means the module is not compiled in
Failure is not an option It's included free
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
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
•
•
Join Date: May 2008
Posts: 246
Reputation:
Solved Threads: 19
Hmm, it dont look like a missing module in apache as the error outputs the redirect URL
Try asking your webhost but other than that im stumped, sorry
PHP Syntax (Toggle Plain Text)
something/mysite/shopping/leftproducts.php?c_id=5
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 =)
2x Macbook Pro's, 1x Mac Pro, 1x iMac, 2x Macbook's running Fedora linux - In conclusion, I hate windows =)
![]() |
Similar Threads
- Mod_Rewrite Problem (Linux Servers and Apache)
- J2EE Architecture in Brief (JSP)
- mod_rewrite and PHP problem (PHP)
- Temporary Web Page problem (ASP.NET)
- Removing Query Strings (ASP.NET)
Other Threads in the PHP Forum
- Previous Thread: how to save and retrieve an image using mysql and php
- Next Thread: spelling mistakes ?
| Thread Tools | Search this Thread |
apache api array basic beginner binary broken cakephp checkbox class cms code computing confirm cron curl customizableitems database date delete display dynamic echo email error external file files filter folder form forms forum function functions gc_maxlifetime google headmethod host href htaccess html iframe image include insert ip javascript joomla limit link login mail malfunction memmory memory menu mlm multiple mysql navigation oop parsing paypal pdf php phpmysql problem query question radio random recursion remote script search select server sessions sms snippet soap source space sql syntax system table thesishelp trouble tutorial update upload url validator variable video web xml youtube






