Support » Fixing WordPress » Permalinks mess

  • Resolved timothy15

    (@timothy15)


    I’m REALLY a novice here and it appears I’ve messed things up royally. To begin with I edited the permalinks structure using the suggestion provided by WP, and it has never worked. I’ve tried everything I can from Codex to outside suggestions but nothing is working.

    My number one problem is I can’t get to my Permalinks sub-directory to go back to the default unpretty structure. When I attempt to go to Options – permalinks ( http://monasticism.org/monk/wp-admin/options-permalink.php) I get a page that looks like a lot different than the WP Admin pages do. And when I attempt to edit the structure on that page I get a 404 error. I then have to go and delete the .htaccess file to get my site back.

    Anyone have an idea as to how I can restore the unpretty permalink structure untill I’m more knowledgable and ready to do some editing? Any help would be greatly appreciated. Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Use phpMyAdmin.

    Connect to your database.
    Select the option table (wp_options if you’re using the default table prefix).
    Click the SQL tab at the top.
    Type in the following:
    UPDATE wp_options SET option_value = '' WHERE option_name = 'permalink_structure' LIMIT 1 ;

    That will erase the permalink structure you defined. Be sure to also remove (or edit) the .htaccess file.

    Thanks, Skippy. I typed in your code and came up with this message from SQL:
    #1064 – You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ‘-options SET option_value = ‘ ‘ WHERE option_name = ‘permalink_

    I must have put in too many spaces or something else incorrect. This is what my line looks like:
    UPDATE wp-options SET option_value = ‘ ‘ WHERE option_name = ‘permalink_structure’ LIMIT 1

    Can you see what I might have done wrong? Thanks, again.

    You need to use an underscore, and not a hyphen, in wp_options.

    Thanks again! After the correction I was able to get to the permalinks page in WP-Admin, but when I tried to view my site again I got the 404 again. I deleted the .htaccess file, but it came back as soon as I accessed the permalinks page. I hesitate to include the code in the file because it’s so long, but here it is:

    RewriteEngine On
    RewriteBase /monk/
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^.*$ – [S=43]
    RewriteRule ^(personal-profile)/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(personal-profile)/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(personal-profile)/page/?([0-9]{1,})/?$ /monk/index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(personal-profile)(/[0-9]+)?/?$ /monk/index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(personal-profile)/trackback/?$ /monk/index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^(contact-me)/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(contact-me)/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?pagename=$1&feed=$2 [QSA,L]
    RewriteRule ^(contact-me)/page/?([0-9]{1,})/?$ /monk/index.php?pagename=$1&paged=$2 [QSA,L]
    RewriteRule ^(contact-me)(/[0-9]+)?/?$ /monk/index.php?pagename=$1&page=$2 [QSA,L]
    RewriteRule ^(contact-me)/trackback/?$ /monk/index.php?pagename=$1&tb=1 [QSA,L]
    RewriteRule ^feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1 [QSA,L]
    RewriteRule ^(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1 [QSA,L]
    RewriteRule ^page/?([0-9]{1,})/?$ /monk/index.php?&paged=$1 [QSA,L]
    RewriteRule ^comments/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1&withcomments=1 [QSA,L]
    RewriteRule ^comments/page/?([0-9]{1,})/?$ /monk/index.php?&paged=$1 [QSA,L]
    RewriteRule ^search/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?s=$1&feed=$2 [QSA,L]
    RewriteRule ^search/(.+)/page/?([0-9]{1,})/?$ /monk/index.php?s=$1&paged=$2 [QSA,L]
    RewriteRule ^search/(.+)/?$ /monk/index.php?s=$1 [QSA,L]
    RewriteRule ^category/(.+)/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?category_name=$1&feed=$2 [QSA,L]
    RewriteRule ^category/(.+)/page/?([0-9]{1,})/?$ /monk/index.php?category_name=$1&paged=$2 [QSA,L]
    RewriteRule ^category/(.+)/?$ /monk/index.php?category_name=$1 [QSA,L]
    RewriteRule ^author/([^/]+)/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?author_name=$1&feed=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/page/?([0-9]{1,})/?$ /monk/index.php?author_name=$1&paged=$2 [QSA,L]
    RewriteRule ^author/([^/]+)/?$ /monk/index.php?author_name=$1 [QSA,L]
    RewriteRule ^([0-9]{4})/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&feed=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/page/?([0-9]{1,})/?$ /monk/index.php?year=$1&paged=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/?$ /monk/index.php?year=$1 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&monthnum=$2&feed=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /monk/index.php?year=$1&monthnum=$2&paged=$3 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/?$ /monk/index.php?year=$1&monthnum=$2 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?year=$1&monthnum=$2&day=$3&feed=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/page/?([0-9]{1,})/?$ /monk/index.php?year=$1&monthnum=$2&day=$3&paged=$4 [QSA,L]
    RewriteRule ^([0-9]{4})/([0-9]{1,2})/([0-9]{1,2})/?$ /monk/index.php?year=$1&monthnum=$2&day=$3 [QSA,L]
    RewriteRule ^ /feed/(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1 [QSA,L]
    RewriteRule ^ /(feed|rdf|rss|rss2|atom)/?$ /monk/index.php?&feed=$1 [QSA,L]
    RewriteRule ^ /page/?([0-9]{1,})/?$ /monk/index.php?&paged=$1 [QSA,L]

    # END WordPress

    I deleted the .htaccess file again, but my category links are disabled due to this mess. But at least I have my blog back! Thanks again Skippy.

    If you can now access your permalinks page, delete any permalink structure defined there, and click Save. That should blank your .htaccess.

    Or, create a blank .htaccess and remove write permission to it. In this way, WordPress will be unable to automatically add rewrite rules.

    The permalink structure is gone, but I still get the odd looking permalinks admin page. And even if I delete the .htaccess file it automatically generates itself when I access the permalinks admin page. It’s a circle I can’t get out of. Yikes!!!!

    Please re-read my post above. I gave you a suggestion for how to get out of this loop.

    Create a blank .htaccess file. Remove write permission to said .htaccess file.

    Without write permission, WordPress will be unable to modify the blank .htaccess file.

    That did it! Now, is there a way to recover the ability to have my page and category links work again? When I try and use these links I get this:

    Not Found
    The requested URL /monkcategory/welcome/ was not found on this server.

    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
    Apache/1.3.33 Server at http://www.monasticism.org Port 80

    You’ve been a great help. Thanks.

    I’m in the same loop as timothy15. painful. if i remove permission of wp to generate the wrong-structured-.htaccess, the 404 not found error comes up depressingly. Please please help!

    I just went through something similar. are you guys sure your servers support mod_rewrite? Mine doesn’t and that was the problem. This site: http://www.webmasterstop.com/125.html has a simple way to test. scroll down to ‘shared users’, about 1/2 way down.

    good luck.

    This is the “brief” of the procedure that i made :

    – On a Linux Bash Console, create .htaccess empty.
    – Via ncftp put this .htaccess on the blog’s root directoy
    (mi website is http://www.foo.bar/, mi blog is on http://www.foo.bar/blog/, and my hosting root is /home/user/, i put the .htaccess via NCFTP on the dir /home/user/blog)
    – I change the permissions with ‘chmod 666 .htaccess’
    – Go to Options, Permalinks, activate this with
    /%year%/%monthnum%/Úy%/%postname%/
    – So, i clic on Upgrade…
    – Via ncftp (rocks!), see with ‘more .htaccess’ the content of this file…it’s seem that all is ok.
    – So, change the .htaccess permision to chmod 600.
    – Create a page…
    – Clic on the page…
    – 404!!!

    What’s wrong?

    I’ve make a phpinfo file and it’s seem that the mod_rewrite is activated,

    I think that the wrong it’s with the AllowOverride to my hosting…but, what i can known the “status” of this AllowOverride?
    I know that this line of the httpd.conf is
    AllowOverride All

    Any Idea?

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Permalinks mess’ is closed to new replies.