Mod_Rewrite Newbie

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 ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-30-2005
MarkP
 
Posts: n/a
Default 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.

  #2 (permalink)  
Old 12-30-2005
Robert Ionescu
 
Posts: n/a
Default Re: Mod_Rewrite Newbie

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
  #3 (permalink)  
Old 12-30-2005
MarkP
 
Posts: n/a
Default Re: Mod_Rewrite Newbie

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.

  #4 (permalink)  
Old 12-30-2005
MarkP
 
Posts: n/a
Default Re: Mod_Rewrite Newbie

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.

  #5 (permalink)  
Old 12-30-2005
Robert Ionescu
 
Posts: n/a
Default Re: Mod_Rewrite Newbie

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
  #6 (permalink)  
Old 12-30-2005
MarkP
 
Posts: n/a
Default Re: Mod_Rewrite Newbie

Cheers for that Robert. I will try going back to my host, to see if
they can shed any further light on it.

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 05:49 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0