[wp-trac] [WordPress Trac] #30340: .htaccess bug
WordPress Trac
noreply at wordpress.org
Sat Nov 22 13:05:26 UTC 2014
#30340: .htaccess bug
---------------------------+------------------------------
Reporter: MarjWyatt | Owner:
Type: defect (bug) | Status: closed
Priority: normal | Milestone: Awaiting Review
Component: Rewrite Rules | Version: 4.0
Severity: normal | Resolution: invalid
Keywords: | Focuses:
---------------------------+------------------------------
Changes (by haykayltduk):
* status: new => closed
* resolution: => invalid
Comment:
Hi MarjWyatt,
Thank you for reporting an issue.
I do not believe that the problem (or fix) are related.
Firstly, there is not a duplicate in the generated .htaccess file.
Going through the rules, the main thing to keep in mind is that [L]
indicates the *L*ast part of the rule.
So, the first rule is:
{{{
RewriteRule ^index\.php$ - [L]
}}}
This means '''if''' the requested file is index.php, then this is the last
rule (and evaluate no further rules) and since nothing is specified (the
'-'), then nothing is done.
The second rule is:
{{{
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
}}}
In this rule, it says:
- if what is requested is '''not''' a file ''AND''
- if what is requested is '''not''' a directory ''THEN''
- rewrite the requested URI to /blog/index.php (and evaluate nothing
further)
Back to your redirect rules.
The problem is your first redirect 301.
{{{
Redirect 301 /chocolate-covered-strawberries-edible-arrangements/
http://www.someurl.com/blog/chocolate-covered-strawberries-arrangements/
}}}
If we re-examine the rules above, we'll see that you will hit the second
rules, and then go into a loop.
The reason is that your want to redirect to /blog/..../'''index.php'''
instead.
HTH,
Anand
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30340#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list