| Author |
Mod_Rewrite Newbie
|
|
|
| Hi Guys,
Trying to get a simple Mod_rewrite going to clean up my URL's from php.
My Host tells me that Mod_rewrite is available, and I put up a very
simple script as follows :
RewriteEngine On
RewriteBase /
RewriteRule ^urla$ urlb?page=some page
When I renamed my file new.text to just .htaccess in my public folder I
got a Server Error. Can somebody tell me what I've done wrong, and I
can do to get this going ??
Cheers,
Mark.
| |
| Robert Ionescu 2005-12-30, 5:58 pm |
| MarkP wrote:
> I put up a very
> simple script as follows :
>
> RewriteEngine On
> RewriteBase /
> RewriteRule ^urla$ urlb?page=some page
You're using a blank character here (if you did so in your original
snippet), which needs to be escaped:
RewriteEngine On
RewriteRule ^urla$ /urlb?page=some\ page [L]
> When I renamed my file new.text to just .htaccess in my public folder I
> got a Server Error.
=HTTP Status code 500 - internal server error or what type exactly?
--
Robert
| |
|
| Hi Robert,
I've added that piece of code. I'm getting an internal server error.
Can't seem to see any particular codes on it. Does the .htaccess file
need any kind of name before the . ? and do I need anything else in the
file other than the lines above ??
Cheers,
Mark.
| |
|
| Hi Robert,
I've added that piece of code. I'm getting an internal server error.
Can't seem to see any particular codes on it. Does the .htaccess file
need any kind of name before the . ? and do I need anything else in the
file other than the lines above ??
Cheers,
Mark.
| |
| Robert Ionescu 2005-12-30, 5:58 pm |
| MarkP wrote:
> I've added that piece of code. I'm getting an internal server error.
Possible reasons for a 500:
-> Syntax error (can't see any)
-> wrong charset (must be ANSI -> is usually default in windows notepad)
-> not uploaded in ASCII-Mode via FTP
-> infinite looping (urla and urlb are different -> no looping possible)
-> module mod_rewrite is not loaded (not the case according to the host)
This is all I can remember, what can cause a 500 with mod_rewrite. To
avoid 1 and 4, you can try an external redirect:
RewriteEngine on
RewriteRule ^(.*) http://www.google.com [R,L]
You should see google.com for every request on your server.
> Does the .htaccess file
> need any kind of name before the . ?
No. If you put something in front of the period, it would not be read by
apache as its configuration file.
> and do I need anything else in the
> file other than the lines above ??
If everything is configured: No. Only if you're getting a 403 forbidden,
FollowSymLinks must be enabled. But this is not the case here.
--
Robert
| |
|
| Cheers for that Robert. I will try going back to my host, to see if
they can shed any further light on it.
|
|
|
|