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

RewriteEngine on
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 :

www.something.com/shopping/leftproducts.php?c_id=5

please solve my problem

Thanks In Advance
Shanti.

OK then,
Try this:

RewriteEngine on
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:

/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

shopping/leftproducts/page.html,
shopping/leftproducts/bob.html,
shopping/leftproducts/margret.html

But not

shopping/leftproducts/bob/dog/smily_face.html

I have also added the QSA flag wich is query string append (Or ammend or something :-/ ) so

shopping/leftproducts/page.html?Do=Make a cup of tea

would call

/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

very very thanks for your input....

I got this error:

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...

.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

RewriteEngine on
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

thanks again for your reply...
i got the same error after i tried as you directed...

please give more inputs on this..
thank you..

have you determined that mod_rewrite is enabled in your server
500 Internal server error often means the module is not compiled in

Comments
Thank You ....

thanks bob...
how to know that is enabled or not...
if not how to enable it????

Hmm, it dont look like a missing module in apache as the error outputs the redirect URL

something/mysite/shopping/leftproducts.php?c_id=5

Try asking your webhost but other than that im stumped, sorry :(

Comments
Thank You Somuch.....

Any way thanks for your suggestions...
I will do more work on this...
thank again..

Anybody else here to help me????

OK then, i've looked at it and the URL rewriting rule is working fine (Its redirecting to the right page) and the server is clearly running as there is an error document being displayed. I think you may have an error in your PHP script causing the server to be unable to display it. I think we have solved the original problem but stumbled upon another one by mistake. You could test this theory out.
Make a copy of leftproducts.php (Or whatever you are redirecting to) and replace the contents of the origonal with

<?php echo $_GET['c_id']; ?>

(This will output the c_id variable we get from the HTML file)
so

http://yoursite.com/shopping/leftproducts.php?c_id=hello

should output:

hello

Tell me the results of this plz,
Regards,
Sam Rudge

may be present but not enabled for this folder
if the commerce package is 'theirs' the host may not want any rewrite of the urls to 'break' the shopping cart (thought process only not suggesting any impropriety)
can only ask the provider
too many possibilities to examine via thread posts

Is the re-write in .htaccess means even I type page.php?id=3&t=456 it all redirects to a certain url like "page/3/456"?

Is the re-write in .htaccess means even I type page.php?id=3&t=456 it all redirects to a certain url like "page/3/456"?

ya some thing like that...
it depends on our rewriting rule...

Is the re-write in .htaccess means even I type page.php?id=3&t=456 it all redirects to a certain url like "page/3/456"?

ya some thing like that...
it depends on our rewriting rule...

in this particular case noob,
the rule loads the file in the ?id=3&t=456 but makes the url display as page/3/456 so that the user and searchbots see a nice tree structure of files in folders that may not exist, but work like they do.
the site may be stored in database table 'alpha' and not have more than index.php in a root folder, at extreme.

oh alright!
because I have the same problem "PAGE CANNOT BE DISPLAYED"
I have this on my .htaccess

RewriteEngine On

RewriteCond %{REQUEST_URI} !^/index.php.*$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /flexidev/blog/sef/

and still can't get to go.... WHY?!

Thank you all for your inputs specially samarudge and almostbob...
Finally i got this worked by gooogling....
Thanks Again...

shanti

This question has already been answered. Start a new discussion instead.