permalinks - removed index.php now all pages 404

admin2025-01-08  4

I added this code to my .htaccess file to get rid of index.php from the website urls, but now all the pages 404 (the hyperlinks are mapped to the correct url)

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

i set up my permalinks using /%postname%/

what are the next steps in order to troubleshoot this issue?

what is the default permalink for me to revert it back to when it had index.php in the url?

I added this code to my .htaccess file to get rid of index.php from the website urls, but now all the pages 404 (the hyperlinks are mapped to the correct url)

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress

i set up my permalinks using http://1.1.1.1/%postname%/

what are the next steps in order to troubleshoot this issue?

what is the default permalink for me to revert it back to when it had index.php in the url?

Share Improve this question edited Jun 8, 2023 at 21:59 Neil Robertson 1831 silver badge11 bronze badges asked Apr 17, 2019 at 15:31 blaublau 133 bronze badges 1
  • Have you confirmed that .htaccess and mod_rewrite are enabled on your server? – MrWhite Commented Apr 17, 2019 at 22:51
Add a comment  | 

1 Answer 1

Reset to default 1

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.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736267085a1172.html

最新回复(0)