WordPress.org

Make WordPress Core

Opened 7 years ago

Last modified 6 months ago

#23060 reopened enhancement

Throw 404 if URL Rewriting is Used With Default Permalinks

Reported by: onetarek Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Permalinks Keywords: needs-testing dev-feedback
Focuses: Cc:
PR Number:

Description

Suddenly I discovered that my blog is not returning error 404 page. My blog permalink is set as default style http://test.onetarek.com/?p=123
Now I am trying to create 404 error by using this url http://test.onetarek.com/adsfjkasjdd , it showing home page. Then I tested http://test.onetarek.com/?p=123654 now it shows 404 page.
Then I tried to load a not existing image http://test.onetarek.com/wp-content/themes/twentyeleven/images/headers/not-image.jpg it shows my home page instead of 404 page.
I changed my permalink settings to "Day and name" then it show 404 page.

I tested this problem in my another blog, this blog is return 404 page but that is not generated by wordpress. Wordpress 404 theme page is not being loaded. A blank page is being loaded with a message by Apache Server "Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request...."

So what is the problem with permalink settings and 404 page.

Change History (5)

#1 @miqrogroove
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Your server is mis-configured. WordPress is not supposed to load at all in this situation.

The only way I can reproduce this behavior is by changing the permalink setting to default and then manually inserting the mod_rewrite directives back into .htaccess forcing WordPress to load for path /adsfjkasjdd (which it should not do).

#2 @nacin
7 years ago

  • Resolution invalid deleted
  • Status changed from closed to reopened
  • Type changed from defect (bug) to enhancement

If your .htaccess file isn't writable, you may insert the rules on your own, then fail to update your .htaccess file when set to the default permalinks. You also may not be using .htaccess, or even Apache. I think WordPress should attempt to work in this situation.

#3 @miqrogroove
7 years ago

  • Summary changed from WordPress Does Not Return Error 404 When Permalink Structure is Set to Default ?p=123 to Throw 404 if URL Rewriting is Used With Default Permalinks

Summary for enhancement request then...

Note: See TracTickets for help on using tickets.