Bakitai Bakitai - 6 months ago 34
Linux Question

Remove index.php from middle of URL, wordpress on linux

I've tried this code so far:

AddType x-httpd-php54 .php

# 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


But i can't work out what i'm doing wrong with it. The URL does rewrite if i go to url.com/index.php it will change to url.com/ . But if i go to url.com/index.php/sample the url will not rewrite. I think i'm missing a wildcard off the end, but i can't work out what the code is doing at all so it's hard to tweak. I've tried looking on SE, but can't find anything that actually works for linux/wordpress combo. Any ideas?

Answer

Actually this problem is solved in different way. Follow these steps:

Step 1: Go to wp-admin

Step 2: Open Settings > Permalinks

Step 3: Check Post Name Option and Save

you are done now. Check the URL now.