Mod_rewrite - beginners problems

This is a discussion on Mod_rewrite - beginners problems within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi There, I've just started playing around with Mod rewrite and can't get it working no matter how ...


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 08-01-2005
iannorton@gmail.com
 
Posts: n/a
Default Mod_rewrite - beginners problems

Hi There,

I've just started playing around with Mod rewrite and can't get it
working no matter how hard i try.

I'm trying to change

www.someoldwebsite.com/pages.php?PageId=3

to: -

www.someoldwebsite.com/pages-3.html

i've tried the following .htaccess file but it's having no effect.

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^(.*)/pages-([0-9]*).html$ pages.php?PageId=$3


Could anyone give me a few tips?

Any help would be greatly appreciated.

Kind Regards

Ian

  #2 (permalink)  
Old 08-01-2005
Jim Hayter
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

On 1 Aug 2005 04:03:07 -0700, in alt.apache.configuration,
iannorton@gmail.com wrote:

>I'm trying to change
>
>www.someoldwebsite.com/pages.php?PageId=3
>
>to: -
>
>www.someoldwebsite.com/pages-3.html
>
>i've tried the following .htaccess file but it's having no effect.
>
>Options +FollowSymLinks
>RewriteEngine on
>
>RewriteRule ^(.*)/pages-([0-9]*).html$ pages.php?PageId=$3
>


The $3 in the rule should be $2. If the URLs to rewrite are always
<host>/pages..., then I'd drop the (.*) at the beginning. You might
want to change the ([0-9]*) to ([0-9]+) instead, requiring at least
one digit.

HTH,
Jim
  #3 (permalink)  
Old 08-01-2005
iannorton@gmail.com
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

Hi,

Thanks for the response.

I've tried the changes you reccomended so my .htaccess file now looks
like this: -

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^(.)/pages-([0-9]+).html$ pages.php?PageId=$2

However it's still not working.

Any ideas?

Thanks
Ian

  #4 (permalink)  
Old 08-01-2005
HansH
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

<iannorton@gmail.com> schreef in bericht
news:1122919111.563187.150430@g49g2000cwa.googlegr oups.com...
>>The $3 in the rule should be $2. If the URLs to rewrite are always
>><host>/pages..., then I'd drop the (.*) at the beginning. You might
>>want to change the ([0-9]*) to ([0-9]+) instead, requiring at least
>>one digit.

>
> I've tried the changes you reccomended so my .htaccess file now
> looks like this: -
>
> Options +FollowSymLinks
> RewriteEngine on
>
> RewriteRule ^(.)/pages-([0-9]+).html$ pages.php?PageId=$2

You only dropped the *..
.... now (.) the rule will match *exactly* one character.
Try:
RewriteRule ^pages-([0-9]+).html$ pages.php?PageId=$1

HansH


  #5 (permalink)  
Old 08-01-2005
Justin Koivisto
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

Jim Hayter wrote:

> On 1 Aug 2005 04:03:07 -0700, in alt.apache.configuration,
> iannorton@gmail.com wrote:
>
>
>>I'm trying to change
>>
>>www.someoldwebsite.com/pages.php?PageId=3
>>
>>to: -
>>
>>www.someoldwebsite.com/pages-3.html
>>
>>i've tried the following .htaccess file but it's having no effect.
>>
>>Options +FollowSymLinks
>>RewriteEngine on
>>
>>RewriteRule ^(.*)/pages-([0-9]*).html$ pages.php?PageId=$3
>>

>
>
> The $3 in the rule should be $2. If the URLs to rewrite are always
> <host>/pages..., then I'd drop the (.*) at the beginning. You might
> want to change the ([0-9]*) to ([0-9]+) instead, requiring at least
> one digit.


and escape the other dot:

RewriteRule ^pages-([0-9]+)\.html$ pages.php?PageId=$1
  #6 (permalink)  
Old 08-02-2005
iannorton@gmail.com
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

Thanks for the reply, again it's still not kicking into action.

Is there anything obvious i may have missed?

Ian

  #7 (permalink)  
Old 08-02-2005
HansH
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

<iannorton@gmail.com> schreef in bericht
news:1122968644.714529.77930@f14g2000cwb.googlegro ups.com...
> Thanks for the reply, again it's still not kicking into action.
>
> Is there anything obvious i may have missed?

The obvious _I_ am missing here are ...
- to what phraze of whose post are you refering
- what _does_ happen
- what is in the error_log
- what is in the rewrite_log

HansH


  #8 (permalink)  
Old 08-02-2005
iannorton@gmail.com
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

Hi,

I'm currently using the following text in the .htaccess file: -

Options +FollowSymLinks
RewriteEngine on

RewriteRule ^pages-([0-9]+)\.html$ pages.php?PageId=$1

It doesn't seem to be having any effect at all when the page loads,
i've just requested the rewrite and error logs from the hosting
company, will post them as soon as they reply.

Thanks

Ian

  #9 (permalink)  
Old 08-02-2005
iannorton@gmail.com
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

I've just got it working!

Thanks ever so much for everyone's help.

Ian

  #10 (permalink)  
Old 08-08-2005
Holger Butschek
 
Posts: n/a
Default Re: Mod_rewrite - beginners problems

What was the sollotion?

Holger


 
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 10:18 PM.


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