If you have landed on this post you definitely want to change your WordPress website’s URL structure by adding .php extension after the slug at the end of the URL for some reason. Unfortunately, You have no way of changing the URL by editing the slug in your WordPress post or page because of the sanitize_title_with_dashes() function of WordPress.

Some people change this because they believe it’s a good factor for ranking better when it comes to SEO. The other reason is moving from a PHP site to a WordPress website & still, you need to keep your previous URLs because you’ve already published them in several places online. There may be other reasons to change this too. However, we’ll learn how to change your WordPress Post & Page URL by adding .php at the end.

Before that, If you want to add .html after WordPress slug at the end of the URL without a slash (/) you can read it here: How to add .html extension to WordPress URL.

Add .php at the end of the WordPress Post url

If you need to add .html at the end of your WordPress Post URL. Follow these steps.

  1. Login to your website’s WordPress dashboard.
  2. Go to Settings >> Permalinks
  3. Under Permalink Settings set Custom Structure for URL by removing slash “/” at the end of it & insert .php
  4. Save Changes & Go to a post to check the change.

Add .php at the end of the WordPress Page url

Although you have changed your post URL structure, it wouldn’t add .php extension after the page URL. Here what you can do to add .php after your WordPress page url slug too.

  1. Login to your website’s WordPress Dashboard.
  2. Go to Plugins >> clek Add New
  3. Search for the Plugin “html after url
  4. Install & Activate the plugin
  5. Then go to Plugins >> Plugin Editor >> Select html-after-url.php file
  6. In that file change anything .html to .php
  7. Click update file & we’re done

Hope this will be helpful whatever the purpose of changing your WordPress website url structure. Don’t forget to share & leave your feedback under. Thank you.


Hi! I’m Dimuthu Freelance Web Designer, Developer, Creative Graphic Designer, Digital Marketer & Successful Blogger. Hire me! if you need any support.

Write A Comment

Pin It