This is a discussion on Mod_Rewrite Newbie within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi Guys, Trying to get a simple Mod_rewrite going to clean up my URL's from php. My Host tells ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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. |
|
|||
|
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. |
|
|||
|
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 |