Simple rewrite doesnt work

Hi Chaps…i hope someone can help with this.

One client of mine wants to move to another server. The htaccess script works fine on the present serevr, however on the new host fails completely with a 500 error.

The new host is 1&1 and they do not offer any assistance with there setup, therefore i need to pop over here.

For a simple redirect i had used

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php

…when it went to page not found, rather than going to the index.php it went to the sedo parking on the host server.

I was advised that i must put the absolute link in the htaccess file so i tried

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*)

…and this also failed (again to sedo parking)

Is there something i can do to ‘test’ if apache is working correctly on the server. 1&1 have been very unhelpful, and i need to ‘prove’ that the problem is at their end. I would love to go elsewhere but its not my call.

Thanks in advance



What is the old url, and what is the new url?

Also, DK’s prolly gonna pop in here and freak over the (.*) since that’s a pretty wide-open door you’ve got there. Ideally with regexes you want to match what you expect to match.

But important to start is what exactly the urls are. Did this person change domain names too? IS there an index.php?

*edit also, do you have your base set in the .htaccess?

the url isnt ‘real’…its a sub domain thats setup prior to moving over…

Ive tried to keep the variables as open as possible, just to try

In the server, i have the index.php (when i go to the subdomain it shows), however if i click a broken link (which all are, as the rewrite file doesnt work), it points to a sedo parking page (which is maybe, another index.php file in another part of the server structure)


Yeah but I mean, state exactly an example of the link that is broken, and where it needs to redirect to.

Ah, you’re not the only one who needs to keep some stuff private. In which case you use urls like this to describe what you want:
This has your url’s structure. I know is a reserved domain name that no real user will ever have… in any case, it stil accurately describes your link so we can figure out regexes for them! Without giving your client a bad rap or anything : )

When I click on first link, this is where it tries to take me:

(added spaces to stop url shortening)

I do NOT know what the actual file name is that you need that url to go to, unless it’s exactly the same but ending with /index.php.

Maybe because I’m new enough to urls, I’m very uneasy with the apostrophe and I’ve heard plenty of people say, try NOT to have those in your url… but maybe a robot is generating these and always properly escapes them…[/ot]

Anyway, so we have half of your requirement. We know what you want the url to look like, but we still don’t know what your destination file path looks like. I was able to click on the link on the living site, but since mod_rewrite is working there, I cannot see the true filename (since the redirect is working correctly, lawlz).

So, see what I did above, do that with the ACTUAL file path, and then the gurus around here will know why your regex is failing and what you need.

It’ll be above my head because if I understand you correctly, you’re going from an to a… possibly that’s done first for all HTTP_HOSTs using RewriteCond and then later RewriteRules for the subfolders.


1&1 (if memory serves), does not support either mod_rewrite (or your use of .htaccess). Ergo, the 500 error (that’s an indicator that you have bad syntax in your .htaccess).


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php

WP has a reason for using the :kaioken: EVERYTHING :kaioken: atom as it needs index.php to handle ALL requests which do not exist as file or directory. It is the file and directory test, too, which eliminates the looping noobies generate by the inappropriate use of (.*) (which is one of my pet peeves as you so tactfully :shifty: noted).

Anyway, that’s the “standard” WordPress code albeit it’s usually wrapped in <IfModule>…</IfModule> to prevent the 500 error that barney has gotten (all the more reason to be knowledgeable about the code you use as a “webmaster”).

You are correct about the absolute redirection, too, but (BECAUSE the code is so obviously WP) barney needs to update his WP configuration file, too, if he expects WP to work on the new server.



I had no clue it was wordpress… I never did a View Source.

(which is one of my pet peeves as you so tactfully noted).

I could say “DK’s gonna 'splode!!! over that one” instead? You seem to have the Flaming Moe’s as a sort of Macro or something : )

It is the file and directory test, too, which eliminates the looping noobies generate by the inappropriate use of (.*).

So… part of the general problem of (.*) is looping caused by no directory checking? I thought it was more about unsafe gobbledygook characters… so now I’m curious about when to use the file/dir check. When I read about it, it seemed pretty straightforward: is it a dir? a file? then do x…


This forum board is full of WP workarounds! Go figure. Their code is so overbearing that it takes full control of EVERYTHING! Okay, everything which does not exist as a file or directory. You CAN get around that by making other redirects BEFORE the WP code, though.

'splode, eh? :fire: No macro, though, I merely type the code for those little icons.

Yes, I have very little (no?) tolerance for the use of “lazy regex” which is, more often than not, the cause of looping or, as you so ably pointed out, garbage sent to a script! Go figure. Same questions, different day. How many years of this can go without a search to discover the obvious cause of the problem?

When to use file/directory checks? Whenever you need to (to prevent looping)? Sounds like a straightforward answer to me! Don’t forget the ! (not), though, so you’re not redirecting from existing files/directories!

Back to my tutorial? Yes, I’ve got a TON of information there (which was intended to prevent carpal tunnel syndrome - THAT didn’t work, did it?).