Web Hosting Talk







View Full Version : Rewrite Engine not working since migration


riquelme
03-03-2006, 12:00 PM
Hello,
Thanks for looking into this matter.

Since our Webhosting provider asked us all to migrate all of our IPs, I have done so as well.

However, when my website migrated, and I anticipated all the DNS changes, the rewrite engine wasn't working anymore

It is still not working since more than a week, meaning half the website is down since then..

I really don't know where it comes from.

The rewrite engine was meant to to the following

redirect
http://www.domain.com/index.php?u=something
into
http://something.domain.com

I'm sure it's well written because it was the same before migration, and it was working till then

When i go to http://something.domain.com , the domain is resolved, but leads to the plesk default page that you get into when a domain is not configured properly or DNS are not applied

Any help would be greatly apreciated
Thanks!

arkin
03-03-2006, 01:09 PM
use this instead, no rewrite engine needed.

<?php // This code should be put in index.php, arkin/Mar0306. //
$domain = "domain.com";
if (isset($_GET['u'])&&!empty($_GET['u'])) {
preg_match("/([A-Za-z0-9]*)/i",$_GET['u'],$redirect);
if (!empty($redirect[0])) die(header("Location: http://".$redirect[0].".".$domain));
}

This should work, sorry i took so long to reply.

Change $domain to your domain.

riquelme
03-03-2006, 01:25 PM
sorry!

I made a typo, i meant that the redirection which isn't working is the
http://something.domain.com (http://something.domain.com/)
into
http://www.domain.com/index.php?u=something


all the opposite

Thanks nonetheless for your help!

arkin
03-03-2006, 01:30 PM
Oh dear :D

Have you checked that the rewrite module is enabled in your apache configuration and that the DNS propogates the the IP address of your server for all the subdomains?

riquelme
03-03-2006, 02:33 PM
DNS both on the server and those who sold me the domain have the * (wildcard) applied directing to the IP

The rewrite engine I suppose is working since I haven't deactivated it after having migrated IPs (it was working before)

riquelme
03-03-2006, 06:44 PM
please share your thoughts so I can apply them and let you know

maxymizer
03-03-2006, 09:06 PM
Can you post your rewrite rules and doublecheck that you have wildcard DNS entry for your domain?

riquelme
03-03-2006, 10:19 PM
hi

here is what my DNS looks like
domain.com. NS ns.domain.com.
*.domain.com. A 208.65.60.88
mail.domain.com. A 208.65.60.88
domain.com. A 208.65.60.88
ns.domain.com. A 208.65.60.88
webmail.domain.com. A 208.65.60.88
ftp.domain.com. CNAME domain.com.
www.domain.com. CNAME domain.com.
domain.com. MX (10) mail.domain.com.
208.65.60.88 / 24 PTR domain.com.

And this is what my rewriting engine looks like



RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.domain\.com?<>/([^/]*) [NC]
RewriteCond %1<>%3 !^(.*)<>\1$ [NC]
RewriteRule ^(.*)$ - [E=BLOGUSER:%1]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^page([0-9]+)/?$ /index.php?u=%1&page=$1 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^profile/?$ /profile.php?u=%1 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive_(.*)_(.*)_.html$ /archive.php?u=%1&y=$1&m=$2 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive_(.+).html /archive.php?u=%1 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^archive.html /archive.php?u=%1 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^([0-9]+)/?$ /entry.php?u=%1&e_id=$1 [L]

RewriteCond %{ENV:BLOGUSER} ^(.+)$
RewriteRule ^$ /index.php?u=%1 [L]


thanks again, any help is apreciated !

riquelme
03-04-2006, 11:05 AM
any help please?
is the code correct?
DNS is set correctly?

riquelme
03-05-2006, 04:23 PM
any rewritting engine gurus out there? :unhappy:

riquelme
03-05-2006, 04:58 PM
could we try to put some basic rewritting stuff to test if it actually works? that way we'd know the problem is coming fom DNS

RadiantDesigns
03-05-2006, 07:02 PM
yea testing it would def be the best idea..

riquelme
03-06-2006, 03:27 AM
your site's animation is wonderful RadiantDesigns, grats for it


Do you happen to know a basic rewritting rule to test ? I have no knowledge in rewritting engine... I wasn't who made that one (although he worked before changing IPs)