[wp-trac] [WordPress Trac] #30340: .htaccess bug
WordPress Trac
noreply at wordpress.org
Fri Nov 14 07:32:38 UTC 2014
#30340: .htaccess bug
----------------------------+-----------------------------
Reporter: MarjWyatt | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 4.0
Severity: normal | Keywords:
Focuses: administration |
----------------------------+-----------------------------
I'm writing some redirects for a client. When I was redirecting to a
page/post on the same subfolder instance of WordPress, things went fine.
When I added a redirect to a URL away from that subfolder, it did not
work.
Here is a redirect to another page on the same subfolder instance:
`Redirect 301 /chocolate-covered-strawberries-edible-arrangements/
http://www.someurl.com/blog/chocolate-covered-strawberries-arrangements/`
Here is the redirect code to an external URL:
`Redirect 302 /about/ http://www.someurl.com/about-us/`
While troubleshooting this today, I discovered that the cause was in the
code generated by WordPress when I saved permalinks.
Here is the .htaccess generated by WordPress when saving permalinks:
`# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress`
Note the duplicate RewriteRule for index...
I revised the .htaccess file to:
`# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^index\.php$ - [L]
#RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress`
Lo and behold! My redirect to an external URL worked.
I think this is a bug.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30340>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list