0

I'm testing the rule below else where and it's working but on my system it's not (centos 7, Apache/2.4.6) [I changed my domain to domain.com for the post here]

the purpose of the rule is to rewrite http://domain.com/story.php?id=xxxx to http://domain.com/story.php?id=xxxx

note that the wordpress rules work but this one does not

RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=([^&]+) [NC]
RewriteRule ^story\.php$ /?p=%1 [L,NC,R=302]

my .htaccess file is below (incase there are conflicting rules)

RewriteBase /
Redirect 301 /forums http://domainforums.com
Options -Indexes
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/forums/(.*)$ /forums/$2 [R=301,L,QSA]
RewriteRule ^([a-z]{2}|zh-CN|zh-TW)/(.*)$ http://$1.domain.com/$2     [R=301,L,QSA]
RewriteRule ^(server-info|mv-server-status) - [L]

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
moebin
  • 1
  • 2

1 Answers1

0

$ sign used at the end of rule like this:

^story\.php$

means the end of matching, so the rule will only work for such request:

http://domain.com/story.php

but not for anything else, eg.:

http://domain.com/story.php?id=1
Tomasz Klim
  • 458
  • 5
  • 10
  • Doesn't apply here. The `$` ending matches the ending of the `path` section of the URL. Parameters aren't matched here, they are matched using the `RewriteCond` part. – Tero Kilkanen Jul 16 '15 at 13:43