Solved

RewriteRule works on one server but not on megaservers.com

Posted on 2010-09-02
10
327 Views
Last Modified: 2013-12-13
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_string($_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_Recordset_getpages, $connect) or die(header("Location:problems.php"));
$row_Recordset_getpages = mysql_fetch_assoc($Recordset_getpages);
$totalRows_Recordset_getpages = 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
0
Comment
Question by:jblayney
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 3

Expert Comment

by:Peter_Werner
ID: 33591438
Use RewriteLog and RewriteLogLevel to see what went wrong on that server. (Or post it here if you can't.)
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 33592146
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.
0
 
LVL 11

Expert Comment

by:mattibutt
ID: 33592516
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
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Author Comment

by:jblayney
ID: 33596455
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/newsite/index.php was not found on this server.
0
 
LVL 1

Author Comment

by:jblayney
ID: 33596637
talking to the help desk now, they keep blaming my code and say the server is a dual microsoft / linux
0
 
LVL 1

Accepted Solution

by:
jblayney earned 0 total points
ID: 33596864
ok i have a solution the server admin gave me

i needed to add this..

RewriteBase /newsite
0
 
LVL 3

Expert Comment

by:Peter_Werner
ID: 33597384
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.
0
 
LVL 1

Author Comment

by:jblayney
ID: 33597479
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...
0
 
LVL 3

Expert Comment

by:Peter_Werner
ID: 33597548
Was it really in DocumentRoot at both sites?
0
 
LVL 1

Author Comment

by:jblayney
ID: 33598322
on both servers it was in a test area
 www.website.com/testsite  and  www.anothersite.com/another_testfolder/
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
In Solr 4.0 it is possible to atomically (or partially) update individual fields in a document. This article will show the operations possible for atomic updating as well as setting up your Solr instance to be able to perform the actions. One major …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question