If you want to remove the index.php
from your URL structure, then using this rewrite rule (assuming you’re using Apache, from your question) in your .htaccess will help.
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Then, flush permalinks by either using WP-CLI and running wp rewrite flush
, or visiting the Permalinks settings page and clicking the save button. You don’t need to make any changes before saving, but if you want to be sure to use just the post slug, click that radio option first, then save to flush permalinks.
Related Posts:
- After moving from subdirectory to home, home page does not display
- Problems redirecting to “pretty” permalinks (wordpress in Subdirectory)
- AWS WordPress Install – pages/posts 404 on restart until updating permalinks
- WordPress 404 in development area
- Custom Permalink
- Page preview is shown, updating page gives 404 error
- Accessing Subdirectories in WordPress Install
- old permalinks not found
- LetsEncrypt WordPress on the Raspberry Pi – Nice url’s give 404 with https, http works
- When using number in url it is redircting to same page but when using character it redirects to 404
- Folder Name and Category Name WordPress
- After server migration only the homepage works
- Changing permalinks gives me 404 errors on nginx
- Setting up WordPress with Custom Permalinks and no .htaccess File?
- Does WordPress Change the .htaccess File When Updating?
- Setting 404 page in Nginx
- Including category-base in a post permalink results in 404
- WordPress thinks my custom route is a 404
- Move WordPress to subdirectory, keep ALL URLs
- 301 Redirects for Changed Permalink Structure & Category Base
- Permalinks to Custom does not work (out of box)
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How do I turn off 301 redirecting posts (not canonical)?
- Permalink Issues by Installing WordPress in Subdirectory / Subfolder
- Passing variables through permalink structure
- WordPress on a subdirectory of Laravel – WordPress pretty permalinks inner page shows laravel
- How to map permalinks with accented letters to sanitized slugs?
- Homepage loads but all permalinks are 404 when using nginx & PHP-FPM
- Remove subfolders from URL
- Changing Permalinks to a Custom Permalink causes a 404 Error [no matter what I do]
- 404 on category.php pagination
- htaccess or redirect to cloak portion of a link?
- WordPress overrides the GET variables, (page_id) set in HTACCESS
- custom naming of search permalink /search/
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- Changing URL from /%postname%/%post_id to /%category%/%postname%/%post_id%
- Using only %postname%
- Posts not working on windows after changing permalinks
- Rewriting search permalink
- removing index.php IIS 7.5 webconfig
- Rewrite rule never matching
- wordpress permalinks tweeks
- Getting a 500 internal server error ONLY on wp-admin/options-permalink.php
- Redirect user if it’s not logged in
- Redirect old permalinks with Month and name to Post name on new site
- Custom url for a single page
- Using WP rather than .htaccess to redirect pages/posts
- Permalinks Structure and 404 Question
- .htaccess – Redirect duplicated post ended in ‘-number/’ to the same url without the -number/
- Attachment page 404 not found when image is attached to post
- What happens when permalink settings are updated?
- WordPress redirection problem after moving to a new server?
- Change of permalink structure – redirects in htaccess breaks the archive links
- Specific URL Rewriting with parameters in wordpress
- WP Site in subdirectory Joomla! Site – Permalinks not working
- Changes to permalink structure results in 404 error for all pages other than home
- permalink changed, now getting 404 for every pages
- Rewrite my default post URL
- Permalinks broken regularly
- 404 Page Not Found for Only One Post
- How can I make my .htaccess file writeable by wp-admin?
- Permalink /%category%/%postname%/ returns 404 on OSX
- Permalinks keep reverting to 404 unless I re-save them
- 404 with post name permalinks
- Clean install – Changing permalinks in twentyeleven give 404
- .htaccess file missing from WordPress install directory
- Why does chrome keep downloading a file instead of running the site?
- Permalinks: Page Not Found
- How to protect htaccess so it can’t be overwritten?
- Permalink change made author archive vanished
- Permalinks not working
- Permalinks okay some pages but 404 error on others
- Changes to .htaccess not updating the file (old rules still take effect)
- If I change permalink structures, can I use htaccess to permanantly redirect links?
- Redirect parent taxonomy to it’s child
- Need Help Correct Regular Expression Redirect Code
- Permalinks by page/post name returning 404
- Permalinks settings page blank
- 301 Redirects Result in 404 for WordPress Search Query Strings
- After updating to 4.8 permalinks will not work (all 404)
- Editing Pages Give 404 Error After WordPress Upgrade in Admin Panel
- page nested 3 levels deep shows 404
- Change in permalink structure made javascript cookie not work correctly
- Permalinks not working with Vagrant
- Only default permalink is working mod_rewrite enabled
- Changing the post date without causing 404 error
- Nginx Rewrite Rule:: index.html added to every permalink
- How to redirect to correct pages after permalink structure change
- Moving local wordpress page to a real server subdomain broke my permalinks?
- How to make /search/ without parameters not return a 404?
- 404 Error Problems with sCategory Permalink plugin
- Why does the ‘Month and Name’ Permalink Format not Work on my new WordPress Site (running on IIS7)?
- How do I add /blog/ as a prefix to permalink structure for posts, categories & tags?
- Only plain permalinks working
- WordPress post-name permalink redirects to site.com
- WordPress Sub domain
- How to change old permalink?
- Redirect Uploads Folder to Query Vars in WordPress
- WordPress url ingore permalinks setting [closed]
- Redirect a Blogger Page URL to wordpress