Forum Moderators: phranque

Message Too Old, No Replies

Wordpress .htaccess problems

Having problems with wordpress working when I change my htaccess file.

         

Ingenious

8:46 pm on Sep 22, 2008 (gmt 0)

10+ Year Member



Hi

I have an .htaccess file in my domain root.

I also have a .htaccess file in my wordpress blog which sits here

example.com/blog/

I added...

AddHandler server-parsed .php
SetHandler application/x-httpd-php
AddHandler application/x-httpd-php .php

...to my domain root htaccess so I could link to files without using .php file extensions and my blog has stopped working (just a blank screen with no error message).

My wordpress blog has...

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

...in the htaccess.

I know it is the new htaccess file in my domain root as when I remove it my blog is fine.

Any ideas as to why this is happening?

Thanks in advance

JC

Ingenious

5:10 pm on Oct 2, 2008 (gmt 0)

10+ Year Member



***bump***

Anybody have any ideas on this cos I am stuck?

Cheers

Jonny

jdMorgan

5:58 pm on Oct 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Simplify and focus the problem...

Comment out all of the new lines in your .htaccess file, test, then un-comment them one at a time, test, and repeat. If un-commenting one of them breaks the blog, then comment it out again, and proceed to uncommenting any others that remain. In other words, you want to find all combinations that do and do not allow your blog to function.

Also, be aware that the directives you need to use depend on how PHP is installed on your server. Some need AddHandler, others need AddType. As most of this is beyond the scope of our Apache forum and has been covered in our PHP forum, Id recommend a review of the WebmasterWorld PHP forum library for more info on this topic.

Jim

Marcia

7:22 pm on Oct 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



>>so I could link to files without using .php file extensions

Link from where to where? Are you trying to link from pages in the root to files in the blog? And are those Wordpress files "Pages" or "Posts" generated by the loop (which is how WP works)?

If a Wordpress file has a .php file extension, then that's how you have to link to it; but if you're trying to eliminate using the php file extension in blog posts, that isn't done in .htaccess at root level, it's done directly from within the Wordpress settings.

Wordpress will always generate posts/permalinks with a .php extension, by default. But when changing settings for how Permalinks are displayed, Wordpress is generating the rewrites.

But it isn't clear exactly what you're aiming to do, or where.

[edited by: Marcia at 7:36 pm (utc) on Oct. 2, 2008]

Marcia

9:26 pm on Oct 2, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is a Wordpress specific issue, but let me make things a little clearer.

ALL my sites are either .htm or .html but I use .htaccess so that those pages will be parsed for php. Depending on the server setup, it's either AddHandler or AddType.

I'm working on a site right now that uses .html in the "main site" but to use PHP includes and have those pages parsed for PHP, I've got this in the root .htaccess

AddHandler application/x-httpd-php .html .htm .php

That has nothing to do with Wordpress, which is installed in www.example.com/blog/ and is working just fine. Wordpress will *never* generate anything but .php pages, but you can control how the posts appear by using settings in the control panel to specify how you want the posts to appear and then Wordpress does all the rest of the work.

[codex.wordpress.org...]