Hi, Thanks in advance for your help.... I am beginner with mod_rewrite(among other things) and I can't seem to get it to work. My site is built with phpprobid(.com). My site is hosted on 1and1.com and the reason I mention that is it may have something to do with my troubles. My site is www.rutscameras.com Here is what I have in my .htaccess file and I am still getting multiple links with 404 errors: -------- RewriteEngine On RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2 RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) RewriteRule ^(.*)$ index.php [F,L] Any help you can offer is greatly appreciated! If you need more info let me know and I will answer anything I can. Thanks!
What are some links you're getting 404s on? The htaccess file doesn't do much but tell links such as yoursite.com/hello,there to go to yoursite.com/there.php?rewrite_params=hello&page_url=there The last part blocks access (403 Forbidden) when queries include base64_encode, <script>, GLOBALS= and _REQUEST= parameters to avoid injection and XSS attempts.
Here are some of the links I get the 404 error. mod_rewrite enabled, 404 Error: http://www.rutscameras.com/new_item,option,sell_item mod_rewrite disabled, works fine: http://www.rutscameras.com/sell_item.php?option=new_item mod_rewrite enabled, 404 Error: http://www.rutscameras.com/help,page,content_pages mod_rewrite disabled, works fine: http://www.rutscameras.com/content_pages.php?page=help mod_rewrite enabled, 404 Error: http://www.rutscameras.com/faq,page,content_pages mod_rewrite disabled, works fine: http://www.rutscameras.com/content_pages.php?page=faq Thanks for taking a look at this!
It doesn't appear to have changed anything. I am still running into the same 404 errors on the same links. Maybe I put it in the wrong spot in the htaccess file? Does that matter? Thanks again!
Unfortunately I am still getting the same results with the following as the htaccess file: Options -Multiviews RewriteEngine On RewriteRule ^(.*),(.*),(.*)$ $3.php?$2=$1 RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2 RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) RewriteRule ^(.*)$ index.php [F,L]
Could it have something to do with using 1and1 for hosting? I have heard rumblings about issues with mod_rewrite while using 1and1. I have found a few items you will understand better than I will. Please let me know what you think..... I just found these dicussions(sorry for the spaces after the http:// but I can't post links yet.... http:// forums.digitalpoint.com/showthread.php?t=893009 : One and One doesn't allow PHP short tags. I've used them for quite a while and I haven't had short tags work at all. You have to go the extra 3-letters milehttp:// forum.cmsmadesimple.org/index.php?topic=8550.0 : FYI...1and1 hosting shared Linux accounts work great as an alternative. All that needs to be done there is simply switching the pretty URL switch in config.php to true and you get decent urls (albeit with no extensions) on all pages including news items.
Ahhhhhhhh! I figured it out although I have no idea what I really did..... I found a thread in a different forum that said you need to add the following into the .htaccess to get mod_rewrite to work if you use 1and1 hosting. I have no idea what they do to require this but it works RewriteBase / -------- Options -Multiviews RewriteEngine On RewriteBase / RewriteRule ^(.*),(.*)$ $2.php?rewrite_params=$1&page_url=$2 RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2}) RewriteRule ^(.*)$ index.php [F,L] Thanks for your help Chad!