简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM