Home > OS >  How Can I correct Broken WordPress Permalinks
How Can I correct Broken WordPress Permalinks

Time:05-19

I have run into a problem with my WordPress blog. Previously, I could access pages using URLs like https://mywebsite.com/index.php/all. However, something unexplainable happened such that this URL has been renamed to https://mywebsite.com/?page_id=102. I have tried to change the permalink structure under settings and the link breaks. When the link appears as https://mywebsite.com/all it does not load in the browser. When I manually write it in the browser URL bar as https://mywebsite.com/index.php/all it automatically redirects to https://mywebsite.com/all. It seems as though I can no longer use the index.php name that was previously contained in the original URL pattern hence cannot access the links using human friendly names. How can I possibly fix the problem?

CodePudding user response:

Looks like your .htaccess file was overwritten. Simplest solution is to change the permalink setting back to page_id and then again to Post name it should overwrite .htaccess file, if not try to put that into your .htaccess:

# BEGIN WordPress
# The directives (lines) between "BEGIN WordPress" and "END WordPress" are
# dynamically generated, and should only be modified via WordPress filters.
# Any changes to the directives between these markers will be overwritten.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

CodePudding user response:

If its just about accessing all pages with adding index.php in url then simply you can use custom permalink structure to allow WP to do this.

You mension that its showing page_id in place of name so in permalink you can use %postname for his. take a look on screenshot.

after doing this change your url will work same as you asked.

Click to view screenshot of Custom permalink

  • Related