#330 closed defect (bug) (fixed)
.htaccess generated for permalinks can cause Server 500 error
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | major | Version: | |
Component: | Administration | Keywords: | |
Focuses: | Cc: |
Description
On some web hosts (see below for specifics), the .htaccess generated can cause a Server 500 error - the .htaccess file has a parse problem.
This happened when trying to add the %category% tag to the beginning of the permalink structure. It did not happen when left off:
/%category%/%year%/%monthnum%/%postname%/
generated an .htaccess file that causes the 500 error
while the .htaccess file generated by
/%year%/%monthnum%/%postname%/
did not cause the error.
The problem turned out to be the syntax of the last line of the .htaccess file:
RewriteRule (.+})/?$ /index.php?category_name=$1 [QSA]
When I changed it to
RewriteRule ([a-zA-Z0-9_]{1,})/?$ /index.php?category_name=$1 [QSA]
(which *should* be the semantic equivalent), the Server 500 error went away the behavior worked as expected.
Change History (7)
#3
@
21 years ago
One more thing: the rewrite rule doesn't work for categories with a '-' in them. It needs to be changed to:
RewriteRule ([a-zA-Z0-9_-]{1,})/?$ /index.php?category_name=$1 [QSA]
for it to work.
#4
@
21 years ago
RewriteRule (.+)/?$ /index.php?category_name=$1 [QSA]
leads to unlimited rewrite loop ?
then all images, styles etc. links will be passwd to category_name
#5
@
21 years ago
Maybe solution would be
RewriteRule ([a-zA-Z0-9_-]+)/?$ /index.php?category_name=$1 [QSA]
Forgot to mention:
WordPress version: 2004-09-29 nightly