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 ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
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 |
|
|||
|
<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 |
|
|||
|
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 |
|
|||
|
<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 |
|
|||
|
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 |