Convert the Permalink structure of WordPress in Ubuntu

For users of WordPress services, changing the permalink structure into a certain form is easier to see and read for people than the default form.

TipsMake.com - For those who use WordPress services, changing the permalink structure (URL links point to a specific article in a blog or forum) is a form that is easier to see and read for everyone compared to the default ? p = 123 . And an idea proposed by the WordPress community is widely used to install the plugin Permalinks Migration. However, if not installed and configured properly, the plugin will not work and cause an HTTP 404 Error Message error. In the following article, TipsMake.com will guide you how to overcome this phenomenon.

First, install and activate the plug-in as usual.

Select AdminPanel -> Options -> PermalinksMigration and set up the old structure of the website you are using, in this case we use the default structure, so fill in /% post_id% /

Next, at AdminPanel -> Options -> Permalinks and change this structure to whatever format you want, with various sources and suggestions from the online community, along with the search engine optimization feature. - Search engine optimization (SEO), we will use the form /%postname%-%post_id%.html/

For other plugins, just change the corresponding technical parameters to the correct format that can be used and functioning normally. All posts previously posted using the old permalink structure will return HTTP 404 results unless they are re-indexed by each post manually with Permalinks Migration. So how to simplify this process? Any operator using the current URL will immediately point to HTTP 301 that requires mod_rewrite module to be enabled in the Apache server system, but is currently disabled in default mode. And this is one of the reasons for this phenomenon.

Use locate to search if mod_rewrite.so is available on the server:

sudo locate mod_rewrite.so

Usually, the results will be found in / usr / lib / apache2 / modules .

Switch to the modes-enabled directory:

cd / etc / apache2 / mods-enabled

Proceed to update and open the rewrite.load file:

sudo touch rewrite.load
sudo gedit rewrite.load

Paste the following command into the rewrite.load file:

LoadModule rewrite_module /usr/lib/apache2/modules/mod_rewrite.so

Next, open the file / etc / apache2 / sites-available / default and look for the following parameters:

Indexes Options FollowSymLinks MultiViews
AllowOverride None

and change to:

Indexes Options FollowSymLinks MultiViews
AllowOverride all

Finally, restart Apache:

sudo /etc/init.d/apache2 restart

Good luck!

3.5 ★ | 2 Vote