Forum Moderators: phranque

Message Too Old, No Replies

Yarp!

Yet Another Rewrite Problem...

         

mipapage

12:03 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hey all,

We have access to a server that will be hosting a site shortly. While waiting for the domain to propogate, I'd reaallly like to do some testing, however I'm having some trouble.

The Setup
The server has us set up like this:
[IP_ADDRESS...]

The Screwup!
The following is my htaccess file:


RewriteEngine on
Options +FollowSymlinks
RewriteBase /~username/
RewriteRule ^\.htaccess$ - [F]
RewriteRule ^be/(.*)/$ be/template.php/$1 [L]
RewriteRule ^be/$ be/template.php [L]
RewriteRule ^de/(.*)/$ de/template.php/$1 [L]
RewriteRule ^de/$ de/template.php [L]
RewriteRule ^se/(.*)/$ se/template.php/$1 [L]
RewriteRule ^se/$ se/template.php [L]
RewriteRule ^ru/(.*)/$ ru/template.php/$1 [L]
RewriteRule ^ru/$ ru/template.php [L]
RewriteRule ^(.*)/es/$ es/template.php/$1 [L]
RewriteRule ^es/$ es/template.php [L]
RewriteRule ^(.*)/$ template.php/$1 [L]
RewriteRule ^$ [oldsite.com...] [L]

This file works great for requests to the root template, i.e. [IP_ADDRESS...] redirects as requested when you enter the root (http://IP_ADDRESS/~username/) but chokes (hello 500) when I try and send it to another language, i.e.
i.e. [IP_ADDRESS...] Why?Why?Why?[6]Why?[/6]runs around room in small circles...

I do not have access to error logs, though I may put in a request...

Any ideas? :-]



And, if anyone knows how I can make that monster a little more simple, feel free to enlighten!

Birdman

12:20 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried adding a leading slash to the rewritten URLs?

Eg:

RewriteRule ^es/$ /es/template.php [L]

Also, why is there a rewrite for .htaccess? That file should be protected in the server configuration. I'd probably remove that line.

Regards,
Birdman

mipapage

12:42 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Also, why is there a rewrite for .htaccess...

Thanks Birdman, I was monkeying around with that one, consider it 'cut'!

Leading Slash
I have tried a zillion things, but at your request ;-] I tried again, and here's the result:

The requested URL /be/template.php was not found on this server.

It seems then it looks to the root for the file. I've tried appending 'more path' before the trailing slash (makes sense, no?) but no luck...

Birdman

1:18 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry it didn't help :(

The requested URL /be/template.php was not found on this server

That's a good sign, I think.

Maybe try this:

RewriteRule ^es/$ /~username/es/template.php [L]

And if no go, maybe this:

RewriteRule ^es/$ ht*p://IP_ADDRESS/~username/es/template.php [L]

mipapage

2:00 pm on Mar 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks Birdman...

Sadly, both of those get me 500 Errors. Those were the 'more path' I was referring to; they makes sense, I think, but they don't work!

mipapage

6:44 am on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<bump>

jdMorgan

6:22 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



mipapage,

I'd suggest you drop the RewriteBase directive, eliminate all but two or three RewriteRules, and try to get it working in simplified form. Once you have a single, correctly-working example, you can then incrementally add additional code sections (for additional languages, in your case) and test to make sure it still works.

It's always easier to get simple code working. Simple code is also likely to garner more people willing to help get it working, as it requires a smaller mental effort and commitment of time.

Jim

mipapage

6:58 pm on Mar 23, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nice tips jdMorgan, I'll give it a go.

mipapage

10:36 pm on Mar 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well, after some playing around, turns out it was an include problem [google.com]...

mipapage

8:35 pm on Mar 28, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In addition to the include problem, it seems that if I throw a PHP "headers already sent error" this host returns a 500 Internal Server error rather than the PHP errors.

I don't know if this is common; if not, worth keeping in mind...