• Resolved kenrik

    (@kenrik)


    My site was working perfect with custom permalinks. Now after upgrading to 3.1 I get a 404 error using custom permalinks.

    Normal ugly permalinks work but the custom ones are broken ??

    here is my .htaccess please let me know how to fix this.

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    
    # deny access to wp-config.php
    <files wp-config.php>
    order allow,deny
    deny from all
    </files>
    
    # deny access to readme.html
    <files readme.html>
    order allow,deny
    deny from all
    </files>
    
    # deny access to .htaccess
    <files .htaccess>
    order allow,deny
    deny from all
    </files>
    
    # prevent folder browsing
    Options All -Indexes
    
    # prevent comment posting to requests with no referer
    RewriteEngine On
    RewriteCond %{REQUEST_METHOD} POST
    RewriteCond %{REQUEST_URI} .wp-comments-post\.php*
    RewriteCond %{HTTP_REFERER} !.*example.com.* [OR]
    RewriteCond %{HTTP_USER_AGENT} ^$
    RewriteRule (.*) ^https://%{REMOTE_ADDR}/$ [R=301,L]
    
    # limit size of request body
    LimitRequestBody 10240000
Viewing 15 replies - 31 through 45 (of 55 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    , deleting my .htaccess file.

    did you put a fresh copy back though?

    this didn’t do anything magic.
    i tried building a new .htaccess file in my wordpress root, and it seems even more broken :s

    my blog:
    https://masshuu.com/blog/

    i press on a link and i t doesnt go where it should:
    https://masshuu.com/blog/blog/2010/03/10/many-bears-and-hikes/

    another note, my second wordpress site is not there any longer:
    https://masshuu.com/blog/photography/wp-admin/

    what’s going on, it’s gone wrong?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    imasshuu – Which THIS?

    You gotta be specific here ??

    THIS? all of the above if that is what you are asking.

    I have created a new .htaccess, I have tried the plug-in, I have all other plugins disabled at present.

    and I have a broken site, please how can I provide more information?

    could it be to do with the networked site? that is the only recent change I made otehr than the upgrade to 3.1

    thanks,
    Matt

    I have created a new .htaccess,

    could it be to do with the networked site?

    Well, if you put back a single WP htaccess fiel, then yes. you broke it.

    Go back to thenetwork setup menu item.

    Look at the box with the htaccess rules.
    use those rules and ONLY those rules in your htaccess file.

    Hi Andrea,

    I am really lost here, I am not a super advanced user or am missing something, probably both. But could you point me in the right direction and along which lines I need to go to work out what is wrong here please.

    im looking at this page https://codex.www.ads-software.com/Create_A_Network which is what I used to create the second site, but i cant find the tool> network sub panel, which i presume is because either i’ve broken something or due to the fact that i have already done this.

    So that is as far as my knowing of what is going on/wrong is.

    Thanks for your assistance,
    Matt

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    You can get a copy of the .htaccess file from the Create A Netowkr page you linked to.

    Go there, read the section on .htaccess, copy the RIGHT ONE into your .htaccess and use that. See if that helps.

    (and saying ‘all of this’ is really unhelpful. Next time, make a list of what, specifically, you tried. And when replying to a suggestion, let us know which suggestion you’re replying to. Often times there are multiple suggestions between replies, and tell us, in no uncertain terms, WHICH thing you tried helps us help you with less repetition ?? )

    okay I have followed this, and altered the info in my htaccess file to include

    “# BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]
    RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]
    RewriteRule . index.php [L]
    # END WordPress”

    and so now in https://masshuu.com/blog/wp-admin/network/sites.php
    I can see that I have a second site, but when i try and goto the second site’s dashboard i still get “Page Not Found”,

    so next i change my htaccess file to include

    “# BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]

    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule . index.php [L]
    # END WordPress”

    and when i try to see my second site i get a redirection to my root.

    note. my wordpress isn’t in root but in root/blog/

    maybe i should delete the second blog and start from scratch on the second site?

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    If your site is in the BLOG folder, then you need to edit this line

    RewriteBase /

    It should be
    RewriteBase /blog/

    You have to make a similar change in your wp-config.php file.

    By the way, please READ the .htaccess file descriptions in that codex doc. It tells you which one to use. You need to use the SUBFOLDER one.

    If this doesn’t solve your category/tag link list 404’s (pulldown and top level menus) when you have a custom permalink for Blog Posts, try this “action” function. It’s worked on every site I’ve tried (including multi-sites) WITHOUT having to tinker with .htaccess, change the existing permalink structure, or disable any installed plugins.

    The problem is with 3.1’s canonical redirect. Sometimes, just disabling the redirect fixes the pblm. But, if this doesn’t solve it for you, here’s a more extensive alternative hotfix link. Just put the code in your theme’s functions.php file.

    https://wpcodesnippets.info/blog/how-to-fix-the-wp-3-1-custom-permalinks-bug.html

    The decision:
    delete value in ‘Category base’ field and save Permalink settings.

    I tried the usual drill (set permalinks to default, delete .htaccess file, set permalinks to custom) but no matter what I did, WordPress would just create the .htaccess file and then not write anything in it!

    I solved my permalinks problem by adding the following code to .htaccess (my blog is right under /public_html/:

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    # END WordPress
    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Joel, that’s the .htaccess for single site wordPress, and won’t help as much as you’d think for MultiSite ??

    The .htaccess file for multisites would look similar to the the following:


    # BEGIN WordPress MultiSite
    <IfModule mod_rewrite.c>

    RewriteEngine On
    RewriteBase /

    #uploaded files
    RewriteRule ^(.*/)?files/$ index.php [L]
    RewriteCond %{REQUEST_URI} !.*wp-content/plugins.*
    RewriteRule ^(.*/)?files/(.*) wp-includes/ms-files.php?file=$2 [L]

    # add a trailing slash to /wp-admin
    RewriteCond %{REQUEST_URI} ^.*/wp-admin$
    RewriteRule ^(.+)$ $1/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule . - [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    </IfModule>
    # END WordPress MultiSite

Viewing 15 replies - 31 through 45 (of 55 total)
  • The topic ‘WordPress 3.1 Broke Permalinks’ is closed to new replies.