{"id":234,"date":"2007-03-28T10:58:55","date_gmt":"2007-03-28T15:58:55","guid":{"rendered":"http:\/\/teamtutorials.com\/web-hosting-tutorials\/clean-url%e2%80%99s-with-wordpress"},"modified":"2014-08-14T11:46:53","modified_gmt":"2014-08-14T15:46:53","slug":"clean-url%e2%80%99s-with-wordpress","status":"publish","type":"post","link":"https:\/\/teamtutorials.com\/web-development-tutorials\/clean-url%e2%80%99s-with-wordpress","title":{"rendered":"Clean URL’s with WordPress"},"content":{"rendered":"
This tutorial will show you how to setup WordPress to use clean URL\u2019s. Using clean URL\u2019s is one of the first step in Search Engine Optimization (SEO). Besides that, they just look better. <\/p>\n
The default WordPress URL structure is: http:\/\/www.yoursite.com\/?p=123. What does p=123 even mean? Well, I would guess that it is the post id, but what does your reader see? A URL like this will be much better: http:\/\/www.yoursite.com\/category\/title-of-the-post be much better. It will have some meaning to your readers, and more importantly, search engines. The title is one of the most important things a search engine will look at. The better your site places on the SERPs (search engine results page), the more traffic you will drive to your site. Of course this is only one step in SEO, but is a good start.<\/p>\n
There is one thing to keep in mind before you change your permalink structure. You will lose inbound links from other sites and search engines. If you have a large amount of traffic from direct addresses or bookmarks, you will not have to worry about this. If you are just starting out (as we are here at www.teamtutorials.com), I would recommend going with clean URL\u2019s from the start. It is really simple to make a custom permalink structure for WordPress.<\/p>\n
First, if your .htaccess file is writeable, WordPress is supposed to update it automatically. If not it will give you the code to cut and paste into your .htaccess file. I have had problems letting WordPress edit the .htaccess file in the past (it never seems to update it), so I will edit it manually.<\/p>\n
Log on to your WordPress account as the administrator and click on Options and then Permalinks. You should see a page similar to the one below. As you can see, the default settings are select. We want to enable custom URL\u2019s so click the option button next to \u201cCustom, specify below\u201d. Now we need to define the URL\u2019s. There are many variable that you can use, but I will choose to use the category and postname variables. If you would like to use something else (day, month, year, posted, subcategory, etc.) you may want to see the custom permalinks page on the Official WordPress site<\/a>. In the \u201cCustom Structure\u201d box, enter the following. Now scroll to the bottom and click the \u201cUpdate Permalink Structure\u201d button. Now, if you have a writeable .htaccess file, you can ftp to your site and check to see if .htaccess file was edited. If your .htaccess is not writeable, or WordPress didn\u2019t update it, you will need to enter the following code in the file and upload it to your site.<\/p>\n This will tell the server that when it see http:\/\/www.yoursite.com\/categiory\/post-title-here to rewrite it to http:\/\/www.yoursite.com\/index.php?somevariable , but the user will see the clean URL. <\/p>\n To test it, make a new post or use an existing one. Click the link from your homepage to get to the permalink and look at the URL in the web browser. You should see the clean URL and the page should be displayed properly. Here is our ugly default URL versus the clean URL for the same post.
\n<\/a><\/p>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n\r\n<IfModule mod_rewrite.c>\r\nRewriteEngine on\r\nRewriteCond %{REQUEST_FILENAME} !-f\r\nRewriteCond %{REQUEST_FILENAME} !-d\r\nRewriteRule ^(.*)$ .\/index.php\/$1 [L,QSA]\r\n<\/IfModule>\r\n<\/pre>\n
\n<\/a><\/p>\n
\n<\/a><\/p>\n