从wordpress URL中删除index.php

时间:2017-08-06 18:07:57

标签: wordpress apache

我试图通过跟随this video从wordpress网址中删除index.php。

它不起作用。我还通过编辑.htaccess文件尝试了其他几种方法。他们都不工作。

在永久链接设置中,如果我将设置更改为

http://xxxxxxxx/sample-post/

然后"关于"页面没有加载,404。所有编辑.htaccess的方法都不起作用。我试过每个人,例如:this page中的所有方法都不起作用。

2 个答案:

答案 0 :(得分:0)

试试这段代码:

<IfModule mod_rewrite.c>
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteEngine On

# On some hosts (including Rackspace), you need to remove the "#" that comes before RewriteBase to avoid 404 errors:
# RewriteBase /

# Block access to hidden files and directories.
RewriteCond %{SCRIPT_FILENAME} -d [OR]
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule "(^|/)\." - [F]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+)\.(\d+)\.(js|css|png|jpe?g|gif)$ $1.$3 [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>

答案 1 :(得分:0)

我的所有尝试都不起作用,除了这一次:

http://www.jarrodoberto.com/articles/2011/11/enabling-mod-rewrite-on-ubuntu

next_command

我从底部的'Jarrod'的stackoverflow上的this问题得到了这个。