How to change or reset permalinks from the database

The other day in the forums a problem arose with a user that, in a local installation, the permanent links, the permalinks , did not work, reaching a point where he did not even allow him to access the WordPress administration.

A problem with permanent links is really annoying, because you can see your website but all the other links do not work , they all give an error.

The first step in changing permalinks should always be to delete the .htaccess file in the installation root folder, then change the permalinks in WordPress permalink settings, generating a new file .htaccess with the appropriate rules, unless you opt for the simple ones, which do not need an .htaccess file.

Now, as I was saying, there are times when permanent links don’t work .

This, which is usually due to a bad or non-existent server configuration , either because the rewrite module is not active or because it has some limitation, can happen to you both in local and online installations.

If you find yourself in this situation that permanent links do not work for you and you cannot access your WordPress administration to change them, did you know that permalinks can also be modified from the database ?

How to change permalinks with PHPMyAdmin

To modify the permanent links you can do it by accessing your WordPress database from the PHPMyAdmin tool, always available in all hosting services .

Once you access the tool, select your database, look for the wp_options table (the prefix may change, for example otracosa_options ) and click on the name or on the “Browse” link

On the next screen you should look for an option called permalink_structure .

Once you have located it, you will see that in the column called option_value there will be a value, in the example /%postname%/ which is the value of the permanent links active at that moment .

Well, to modify the value for any of the other tags supported by WordPress you can do it in 2 ways :

  • By clicking directly on the value , which opens it for editing. You enter the new value and hit the Enter key (or Enter, whatever you prefer to call it) on the keyboard to save the value.
  • By clicking on the “Edit” button and changing the option_value field to the new one and clicking on the “Continue” button to save the changes.

Here you have capture of both ways of doing it, choose the one you prefer, the result is the same.

What values can I enter to change the permalinks?

The values you can enter are the same tags that WordPress supports on the permalinks page , such as:

  • /%postname%/ – Post name with slash before and after ( mi-entrada )
  • /%year%/%monthnum%/%day%/%postname%/ – Year, month, day and name of the post separated by slashes ( /2021/12/15/mi-entrada/ )
  • Campo vacío – If you want to use simple links – not pretty – leave option_value field empty ( ?p=123 )

Whatever you decide, it will be applied to your WordPress website’s permalink settings instantly, and you can now browse normally with your chosen permalinks.

If, for example, it happens to you as in the example that I told you at the beginning, from a server in which the rewrite module does not work, leave the field empty, which will activate simple permalinks, which always work, even if it is not active the rewrite .

( 6 votes, average: 5 ) Rate this article to help improve the quality of the blog
Share on Twitter Share on Facebook Share on Pocket Share on LinkedIn Share on WhatsApp Share on Telegram

Did you like this article? You can’t imagine what you’re missing on YouTube !

About Us

We are BE OF THEM, a team specialized in the field of digital marketing and programming, our headquarters is in Germany, and our activity has expanded to reach all parts of the Middle East, especially the Arab Gulf countries.

Do you need to raise your site's score?

We have the perfect solution for marketing your business

Contact Us

Call us, or message us by email & whatsapp

We will be happy to talk to you, and knowing everything about your work.

All rights reserved, © 2021