Support » Fixing WordPress » Permalinks stuck on default settings

  • Resolved kb1234

    (@karenbatten)


    Hi There,
    thanks in advance for your help.
    I have read many posted but unfortunately I don’t really follow. I have tried some things but nothing seems to be working.

    I have created a new .htaccess file.
    Originally it had this code in it

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [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).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]

    From the forums I added this code

    # 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

    When I went back to the .htaccess file this code had disappeared and only the below was there.

    # BEGIN WordPress
    # END WordPress

    I am making all these changed under the cpanel x

    Under wordpress I have been going to settings > permalink and when I select the custom setting it just returns to the default and says the permalink structure updated, but it hasn’t.

    Thanks Karen

Viewing 15 replies - 1 through 15 (of 20 total)
  • Moderator t-p

    (@t-p)

    Does the default setting work?
    If it does, then try reviewing Using_Permalinks before setting a custom permalink structure again.

    kb1234

    (@karenbatten)

    Yes default setting does work.
    I have read Using_Permalinks but I don’t understand all the instructions.
    I’m thinking it has something to do with this maybe?

    Pretty permalinks are available under:
    Apache web server with the mod_rewrite module
    Microsoft IIS 7+ web server with the URL Rewrite 1.1+ module and PHP 5 running as FastCGI
    Microsoft IIS 6+ using ASAPI_Rewrite
    Lighttpd using a 404 handler or mod_rewrite (see See Also)

    But I don’t know how to find out which one applies to me.
    I can’t seem to find the httpd.config file and don’t know if I have one…
    Sorry I just don’t understand the instructions.

    Your environment must be “Apache web server with the mod_rewrite module”

    First clear whatever you did to the .htaccess file. It should be complete empty.

    Then instead of a custom structure choose a “Common Setting” such as “Post name” or “Day and name” and see if it works.

    kb1234

    (@karenbatten)

    Thanks for you suggestion.
    I have emptied the .htaccess file to be completely empty.
    When I test changing the permilinks to other settings everyone produces the below error.

    Not Acceptable
    An appropriate representation of the requested resource /wp-admin/options-permalink.php could not be found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Moderator t-p

    (@t-p)

    /wp-admin/options-permalink.php could not be found on this server.

    check and see if this file is there

    @tara the file does exist, it is returning a 406 Not Acceptable Error.

    @karenbatten I think your host uses mod_security which is causing the issue. Edit your .htaccess file and place the following in it

    <IfModule mod_security.c>
    SecFilterEngine Off
    SecFilterScanPOST Off
    </IfModule>

    This will disable mod_security for your WordPress installation. Then try choosing a permalink structure.

    kb1234

    (@karenbatten)

    Thanks Jesin and Tara for your suggestions.

    Tara the file is there.

    Jesin, I make the change to the .htaccess file and this error still appreared.

    Not Acceptable
    An appropriate representation of the requested resource /wp-admin/options-permalink.php could not be found on this server.
    Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

    Looks like your host doesn’t allow overriding mod_rewrite rules. So this has to be done manually.

    Open phpmyadmin, open your WordPress database, select the SQL tab and run the following query

    UPDATE wp_options SET option_value='/%postname%/' WHERE option_name='permalink_structure'

    Then edit your .htaccess file and place the following.

    # 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
    kb1234

    (@karenbatten)

    Thanks again.
    Ok so I have opened ‘phpmyadmin’ in cpanels.
    I aimed to login to the database or SQL section but this error came up
    #1045 Cannot log in to the MySQL server

    Create a file named perma.php in the same directory as the wp-config.php file (usually public_html/) with the following code.

    <?php
    require_once 'wp-config.php';
    mysql_connect( DB_HOST, DB_USER, DB_PASSWORD );
    mysql_select_db( DB_NAME );
    echo ( mysql_query( "UPDATE wp_options SET option_value='/%postname%/' WHERE option_name='permalink_structure'" ) ? 'Success' : mysql_error() );
    ?>

    Access this file and you’ll see “Success”, then add the .htaccess rules if they aren’t present.

    Delete perma.php after this is done.

    kb1234

    (@karenbatten)

    Ok so I have placed the above code in a new file called ‘perma.php’ in teh public_html/ folder where the wp-config.php file is.

    I don’t understand the next step
    Access this file and you’ll see “Success”, then add the .htaccess rules if they aren’t present.

    I have looked in the .htaccess file and this code is there

    # 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

    Did the file print “Success” when you accessed it? Then you are good to go. Permalinks must be working now.

    If it helps any, I was having an issue getting permalinks to work as well. I just spent a good amount of time reading articles about permalinks. I came across one (sorry, dont remember where it was) that showed a permalink address as http://www.domain.com/index.php/blog-name. but when I checked my address bar to see where it was getting directed to, it didn’t have the index.php portion in it.

    just for the hell of it, I selected custom structure and entered: /index.php/%postname%/

    Surprisingly this actually worked. I think wordpress needs to have that issue fixed. Hopefully this will help you out

    PS i did not do anything with any .htaccess files or anything like that. what you see above is all I did

    just an update,

    here is the link to the article I found
    http://codex.wordpress.org/Using_Permalinks

    and the blurb that pointed me in the direction I went

    “Otherwise, they are the same as the “pretty” mod_rewrite permalinks, and are similarly flexible. Anything that mod_rewrite permalinks can do, PATHINFO permalinks can do, with the help of that /index.php part. ”

    @megadeth23 OP’s issue is completely different. Mod_security or some other Web Application Firewall is stripping out POST requests which contain the ‘%’ symbol. From the first post of OP

    Under wordpress I have been going to settings > permalink and when I select the custom setting it just returns to the default and says the permalink structure updated, but it hasn’t.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘Permalinks stuck on default settings’ is closed to new replies.