Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

My .htaccess files are intercepting with wordpress .htaccess files, which modules and which settings (specified by .htaccess) are required for WD site to work? In other words, where can I find default WD .htaccess file?

share|improve this question
add comment

3 Answers

WordPress does not contain .htaccess in file form.

The rules are written into file by save_mod_rewrite_rules() function and are generated by $wp_rewrite->mod_rewrite_rules().

Note that multisite installation has different (more complex) rules and seems to be handled differently.

share|improve this answer
    
+1 for the right direction. Please, review whether I understood the issue right with my answer. I think the central thing is just to use the Rewrite_WP API, not to reinvent the wheel with personal .htaccess -files. –  user14016 Apr 22 '12 at 10:42
add comment

Here is the default code for that file.

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

you can check it here for default htaccess file.

http://codex.wordpress.org/Using_Permalinks.

Thanks. I hope it helps little.

share|improve this answer
    
Please, see the chat here about this. –  user14016 Jun 6 '12 at 3:28
add comment

Use the Freenode's #wordpress to find the appropriate documentation, usually in the /topic. There I found the key Class WP_Rewrite here, the official wordpress.org is at the best misleading and marketing. Anyway, do not mix Apache's rewrite rules with WP's rewrite rules although the naming of WP is probably from Apache's equivalent.

The WP_Rewrite API states

You can add rules to trigger your page view and processing using this component. The full functionality of a front controller does not exist, meaning you can't define how the template files load based on the rewrite rules.

so you must use the API to do the changes, not fully sure what it means but I think it means you cannot trust in your hard-coded .htaccess -files -- things may change even with different WD -versions! So use the API.

intercepting

The code here has some conditions if the .htaccess -file exists -- not 100% of their inferences because not well-documented and cannot understand the naming there but the central message is probably that the safe way to maintain the rewrite rules is to use the WP_Rewrite API, WP may change in the future.

For example, a simple Apache-rewrite RewriteRule ^hello$ Layouts/hello.html [NC,L] is apparently something like add_rewrite("^hello$", "Layouts/hello.html"), haven't tested but tried to follow the API below:

add_rewrite_rule (line 19)
Add a straight rewrite rule.

see: WP_Rewrite::add_rule() for long description.
since: 2.1.0
void add_rewrite_rule (string $regex, string $redirect, [string $after = 'bottom'])
string $regex: Regular Expression to match request against.
string $redirect: Page to redirect to.
string $after: Optional, default is 'bottom'. Where to add rule, can also be 'top'.

Related

  1. http://codex.wordpress.org/Rewrite_API/add_rewrite_rule

  2. http://pmg.co/a-mostly-complete-guide-to-the-wordpress-rewrite-api

  3. Thanks to toscho for assisting here, some small-talk in chat.

share|improve this answer
    
I am quite sure I have misunderstood here something, please, review this chat here. Did it intercept because my blog was on root -level meaning something like www.hello.com/blog/? –  user14016 Jun 6 '12 at 3:33
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.