jblayney
asked on
RewriteRule works on one server but not on megaservers.com
Hello,
I am using a rewrite rule on my server and it works great, but when I put in on megaservs.com it fails...
what it does is rewrite my index.php?id=whatever into pretty .html addresses. on megaservers i get 404 erros, but not the one from my .htaccess
please help me trouble shoot this, megaservers tech support says problem is code and they are helpless..
htaccess
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-z0-9-\']+)\.html$ index.php?page=$1 [nc]
ErrorDocument 404 problems.html
PHP which fetches content and gives pretty URL
$which_page = mysql_real_escape_string($ _GET['page ']);
if(!mysql_real_escape_stri ng($_GET[' page'])) {
$which_page = "index";
}
$query_Recordset_getpages = "SELECT * FROM content WHERE content_menu_url = '$which_page'";
//echo $query_Recordset_getpages;
$Recordset_getpages = mysql_query($query_Records et_getpage s, $connect) or die(header("Location:probl ems.php")) ;
$row_Recordset_getpages = mysql_fetch_assoc($Records et_getpage s);
$totalRows_Recordset_getpa ges = mysql_num_rows($Recordset_ getpages);
and my links...
<a href="index.html" title="link to home">
Like i mentioned, this all works perfectly on another server, it just breaks on mega servers.
They say they have a blended microsoft / apache server, my server is apache
I am using a rewrite rule on my server and it works great, but when I put in on megaservs.com it fails...
what it does is rewrite my index.php?id=whatever into pretty .html addresses. on megaservers i get 404 erros, but not the one from my .htaccess
please help me trouble shoot this, megaservers tech support says problem is code and they are helpless..
htaccess
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^([a-z0-9-\']+)\.html$ index.php?page=$1 [nc]
ErrorDocument 404 problems.html
PHP which fetches content and gives pretty URL
$which_page = mysql_real_escape_string($
if(!mysql_real_escape_stri
$which_page = "index";
}
$query_Recordset_getpages = "SELECT * FROM content WHERE content_menu_url = '$which_page'";
//echo $query_Recordset_getpages;
$Recordset_getpages = mysql_query($query_Records
$row_Recordset_getpages = mysql_fetch_assoc($Records
$totalRows_Recordset_getpa
and my links...
<a href="index.html" title="link to home">
Like i mentioned, this all works perfectly on another server, it just breaks on mega servers.
They say they have a blended microsoft / apache server, my server is apache
Use RewriteLog and RewriteLogLevel to see what went wrong on that server. (Or post it here if you can't.)
Does megaserv have a help desk? What did they tell you? A blended microsoft / apache server sounds weird to me. I might want to move to a normal hosting company.
hi
if you are using share hosting you need to follow your web hosting guide for rewrite some additional line you need to put at the top of the htaccess file and you are good to go
RewriteEngine on
put this on top
or
RewriteEngine on /
try both and post back
if you are using share hosting you need to follow your web hosting guide for rewrite some additional line you need to put at the top of the htaccess file and you are good to go
RewriteEngine on
put this on top
or
RewriteEngine on /
try both and post back
ASKER
Hello and thanks for responding...
Peter, I dont have access to the http.conf
Ray, I was thinkign same thing, but it isn't an option
mattibutt, no luck with that, didn't change anything
one thing I noticed is that the error message i get doesn't make sense... because all I have is an index.php file (in that folder)...
Not Found
The requested URL /d/i/website.ca/public/new site/index .php was not found on this server.
Peter, I dont have access to the http.conf
Ray, I was thinkign same thing, but it isn't an option
mattibutt, no luck with that, didn't change anything
one thing I noticed is that the error message i get doesn't make sense... because all I have is an index.php file (in that folder)...
Not Found
The requested URL /d/i/website.ca/public/new
ASKER
talking to the help desk now, they keep blaming my code and say the server is a dual microsoft / linux
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah, you moved the whole stuff to a subfolder.
Next time you should try to do the same on your local environment to minimize the differences.
RewriteLog could have been added to .htaccess.
// Credit goes to HelpDesk, good ad for the service provider.
Next time you should try to do the same on your local environment to minimize the differences.
RewriteLog could have been added to .htaccess.
// Credit goes to HelpDesk, good ad for the service provider.
ASKER
actually Peter, it came from a subfolder too where it worked, the other server I use doesn't require that piece of code,
so i learned something good here...
so i learned something good here...
Was it really in DocumentRoot at both sites?
ASKER
on both servers it was in a test area
www.website.com/testsite and www.anothersite.com/another_testfolder/
www.website.com/testsite and www.anothersite.com/another_testfolder/