Make WordPress Core

Opened 12 years ago

Closed 11 years ago

Last modified 10 years ago

#23491 closed enhancement (fixed)

Add hook to insert_with_markers() so theme/plugin authors can prevent writing to .htaccess

Reported by: alimony's profile alimony Owned by: wonderboymusic's profile wonderboymusic
Milestone: 3.7 Priority: normal
Severity: normal Version:
Component: Rewrite Rules Keywords: has-patch
Focuses: Cc:

Description

If not using .htaccess to rewrite, but instead keeping those settings in an Apache config file, it would be nice if writing the .htaccess file could be prevented by hooking into the function that does that (e.g. returning false or something like that).

Why? If the Apache option AllowOverride is turned off (which it should be for performance reasons, if not using any .htaccess files) the file won't ever be read. But still having it around (except cluttering) can possibly confuse someone having access to the server, seeing the file and thinking it actually controls anything. Especially since most WordPress support threads on the Internet assumes that an .htaccess file is used for rewrite rules.

One solution is to keep an empty, non-writable .htaccess file, optionally having a comment in it saying it's unused, but getting rid of the file altogether would be much cleaner. Also, it can still happen that someone accidentally changes the file permission, and someone else (or the same person) saves permalink options, saving a new .htaccess file, having created the possibility of confusion once again.

Attachments (2)

23491.diff (724 bytes) - added by jeremyfelt 11 years ago.
Introduces filter flush_rules_hard
23491.2.diff (722 bytes) - added by nacin 11 years ago.

Download all attachments as: .zip

Change History (11)

@jeremyfelt
11 years ago

Introduces filter flush_rules_hard

#1 @jeremyfelt
11 years ago

  • Keywords has-patch added

23491.diff introduces a filter flush_rules_hard that enables one to skip the creation of a .htaccess file or IIS file. This comes in handy not only for those managing configurations separately, but for Nginx or other web servers as well where the .htaccess file becomes just clutter.

@nacin
11 years ago

#2 @nacin
11 years ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 3.7

My take is 23491.2.diff. Thoughts?

#3 @jeremyfelt
11 years ago

I like that that one better.

#4 @wonderboymusic
11 years ago

  • Owner set to wonderboymusic
  • Resolution set to fixed
  • Status changed from new to closed

In 25328:

Add filter flush_rewrite_rules_hard to give devs chance to prevent writing to file when hard-flushing rewrite rules.

Props jeremyfelt, nacin.
Fixes #23491.

#5 @DrewAPicture
11 years ago

  • Keywords needs-docs added; commit removed
  • Resolution fixed deleted
  • Status changed from closed to reopened

This filter needs a docblock per inline documentation standards

#6 @nacin
11 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 25464:

Add documentation for the new flush_rewrite_rules_hard filter. fixes #23491.

#7 @DrewAPicture
11 years ago

  • Keywords needs-docs removed

#8 @chriscct7
10 years ago

#14549 was marked as a duplicate.

#9 @DrewAPicture
10 years ago

#14549 was marked as a duplicate.

Note: See TracTickets for help on using tickets.