Make WordPress Core

Opened 21 years ago

Closed 21 years ago

Last modified 21 years ago

#330 closed defect (bug) (fixed)

.htaccess generated for permalinks can cause Server 500 error

Reported by: jamesvl's profile jamesvl Owned by: ryan's profile ryan
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)

#2 @jamesvl
21 years ago

Forgot to mention:

WordPress version: 2004-09-29 nightly

#3 @jamesvl
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 @anonymousbugger
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 @anonymousbugger
21 years ago

Maybe solution would be
RewriteRule ([a-zA-Z0-9_-]+)/?$ /index.php?category_name=$1 [QSA]

#6 @ryan
21 years ago

  • Owner changed from anonymous to rboren
  • Resolution changed from 10 to 20
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.