WordPress.org

Ready to get started?Download WordPress

Forums

Althought mod_rewrite works -> 404-errors (15 posts)

  1. infranic
    Member
    Posted 9 years ago #

    hi,

    i'm a newbie to wp, but not to cgi or perl. my environment looks like MySQL 3.23.53, php 4.3, on apache 1.3...

    after succesfull installation of wp 1.5.1 on an apache i fixed a view things:

    1. wwwrun:
    the installation created a new theme-directory named as the blog title with owner wwwrun. fixed it...

    2. permalinks:
    the properly created htaccess had to be fixed the same way as the theme-dir. the really wired thing is, that any links (caths, archives, posts) give me a 404, although i tried any plausible variation for the pathes in the htaccess-file and strukture of the permalinks.

    please help me milking that bug.

    thx

    infranic

  2. Nicki Faulk
    Member
    Posted 9 years ago #

    I am having this problem as well on a test installation of 1.5.1. I hesitate to upgrade my live install of 1.5 to 1.5.1 for this reason. (my test install is a clean/new install)

  3. What are your permalink values?

  4. Nicki Faulk
    Member
    Posted 9 years ago #

    I'm using /%category%/%postname%/

    Do you need my .htaccess contents too?

  5. /%category%/ is only guaranteed to work properly on Apache 2. Try your permalinks without /%category%/.

    http://codex.wordpress.org/Using_Permalinks

  6. Nicki Faulk
    Member
    Posted 9 years ago #

    D'oh! I didn't realize my host was using a previous version of Apache. Thank you macmanx!

  7. JBarnes
    Member
    Posted 9 years ago #

    I just wanted to add that I've been searching for the past couple of days to try and figure out why my static pages weren't showing up. I stumbled upon this thread and decided to check my permalinks and found my htaccess file was not writable. After fixing that, my posts all disappeared and showed a 404 error.

    The /%category%/ hint posted above solved all the issues I was having (and didn't know why I was having them). The incompatability should be one of the first few things suggested to check in problems like these, and it would have saved me a lot of time if I had discovered this thread earlier.

  8. jimdhood
    Member
    Posted 9 years ago #

    Hi,

    I am also having 404 problems. Mod_rewrite is installed on my server, and I can see the static paths being generated as per the browser status bar, but when I click on them, I get the 404 Not Found error. I took the rules generated by WordPress and pasted them into my .htaccess file. The permissions are 666 on .htaccess. I'm using WordPress 1.5.1.2. My Apache version is 2.0.46 with PHP 4.3.2.

    Like I saw in a previous thread, I would also prefer not to have "/index.php/" in my rewritten URL.

    My WordPress blog is at http://www.plasmahdtvtoday.com/blog . The rewrite syntax I am using is: /%post_id%/%postname%/

    Any ideas? Thanks a bunch!

    Regards,
    Jim

    P.S. Below is the contents of my .htaccess file:

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

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /blog/
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ - [S=40]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /blog/index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /blog/index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /blog/index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /blog/index.php?s=$1 [QSA,L]
    RewriteRule ^category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/page/?([0-9]{1,})/?$ /blog/index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^category/(.+)/?$ /blog/index.php?category_name=$1 [QSA,L]
    RewriteRule ^author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/page/?([0-9]{1,})/?$ /blog/index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/?$ /blog/index.php?author_name=$1 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /blog/index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /blog/index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /blog/index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^date/([0-9]{4})/([0-9]{1,2})/?$ /blog/index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^date/([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^date/([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^date/([0-9]{4})/page/?([0-9]{1,})/?$ /blog/index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^date/([0-9]{4})/?$ /blog/index.php?year=$1 [QSA,L]
    RewriteRule ^([0-9]+)/([^/]+)/trackback/?$ /blog/index.php?p=$1&name=$2&tb=1 [QSA,L]
    RewriteRule ^([0-9]+)/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?p=$1&name=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]+)/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?p=$1&name=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]+)/([^/]+)/page/?([0-9]{1,})/?$ /blog/index.php?p=$1&name=$2&paged=$3 [QSA,L]
    RewriteRule ^([0-9]+)/([^/]+)(/[0-9]+)?/?$ /blog/index.php?p=$1&name=$2&page=$3 [QSA,L]
    RewriteRule ^([0-9]+)/trackback/?$ /blog/index.php?p=$1&tb=1 [QSA,L]
    RewriteRule ^([0-9]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?p=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]+)/(feed|rdf|rss|rss2|atom)/?$ /blog/index.php?p=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]+)/page/?([0-9]{1,})/?$ /blog/index.php?p=$1&paged=$2 [QSA,L]
    RewriteRule ^([0-9]+)(/[0-9]+)?/?$ /blog/index.php?p=$1&page=$2 [QSA,L]
    </IfModule>

  9. jimdhood
    Member
    Posted 9 years ago #

    OK, I've figured it out. The docs say to put .htaccess in the WordPress root, but if WordPress is *not* in the document root of the Web site, to put .htaccess in the site's document root instead. From the Codex:

    http://codex.wordpress.org/Using_Permalinks
    "However, if your WordPress installation is in a subdirectory, but your visitors access your site at the top level of your domain, place the .htaccess file at domain.com/.htaccess. "

    Problem is, I get 404's when the rewrite rules are in the .htaccess of the site's document root. The problem only goes away when I followed the default advice (that is, .htaccess in the WP install directory). Since I have other things going on in my .htaccess, I was hesitant to have 2 .htaccess files (one in docroot, the other in the WP subdir), but I gave it a whirl and all is well. My docroot .htaccess has no WP rewrite rules, and the WP subdir version has *only* the WP rewrite rules.

  10. agitatedamerican
    Member
    Posted 8 years ago #

    I'm having a related problem. My installation did not include an .htaccess file, and pages I created first worked, then didn't. So I searched until I finally learned to create my own, which I did. Then the pages I had created worked again.

    I created two new pages, and can't load them(Not Found). So I created a new htaccess file, erasing the old. Same thing. It's inside the WP root, one down from site root. It is much longer than jimhood's, above, I don't want to add it here.

    So I copied jimhood's and put that into the site root folder. Same thing.

    I'm using permalinks

    /%year%/%monthnum%/%day%/%postname%/

    I have WP 1.5.2, am a newbie, my site is http://www.agitatedamerican.com/blog. I use bbedit, can set permissions to read, write and execute for owner, group and everyone. So far only read for group and everyone, all three for owner.

    Is there something here that is why the two new pages do not open, but the others do? Do I need to set permissions for everyone??? (very dangerous, I assume).

    Thanks for any help on this I can get.

  11. Set the permissions for the .htaccess file to 666 (CHMOD 666), set your permalinks again (in Options/Permalinks), and then change your .htaccess file back to 644 (CHMOD 644). That should work.

    More info:

    http://codex.wordpress.org/Changing_File_Permissions

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

  12. agitatedamerican
    Member
    Posted 8 years ago #

    Okay, that worked! My problem is, my FTP is bbedit, which does not allow entering any number (666). I simply set all permissions to "write", changed the Permalink file, then went back and took the write permissions off. This might help someone else who has this problem.

    Thanks again!

  13. Don't use BBEdit as your FTP client. Use a dedicated FTP client, like Cyberduck.

  14. IsaacSchlueter
    Member
    Posted 8 years ago #

    If you are using Apache 1.3 and want to use %category% in your permalink (along with having working category and search feeds) you can use the plugin I made. It's been working really well in a lot of different situations now. The only thing is that, for some reason that I have yet to work out, you can't have both numeric items (like %year%, %postid%, etc) and %category% in your permalinks at the same time.

  15. IsaacSchlueter
    Member
    Posted 8 years ago #


Topic Closed

This topic has been closed to new replies.

About this Topic