永久链接在 Windows 7 上的 xampp/localhost 服务器中不起作用

Bil*_*lal 3 xampp wordpress .htaccess permalinks

当我从 wordpress 管理员点击永久链接时,它会自动在根文件夹中创建 .htaccess 文件,然后 wordpress 站点停止使用浏览器错误服务器错误 500我在 httpd.conf 中进行了以下设置,我的 mod_rewrite 正在按照 php 工作。 ini 显示。

httpd.conf 设置

<Directory "E:/xampp/cgi-bin">
    Options FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>
Run Code Online (Sandbox Code Playgroud)
<Directory "E:/xampp/htdocs">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.2/mod/core.html#options
    # for more information.
    #
    Options All

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   Options FileInfo AuthConfig Limit
    #
    AllowOverride All

    #
    # Controls who can get stuff from this server.
    #
    Order allow,deny
    Allow from all

</Directory>
Run Code Online (Sandbox Code Playgroud)

HTACCESS 文件代码

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /xampp/ozi-tech/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /xampp/ozi-tech/index.php [L]
</IfModule>
# END WordPress
Run Code Online (Sandbox Code Playgroud)

小智 6

如果您的项目位于
E:/xampp/htdocs/ozi-tech/,
那么您需要指定从 localhost 开始的路径。

E:/xampp/htdocs/  === localhost === /
Run Code Online (Sandbox Code Playgroud)

您只需要在 .htaccess 中更改RewriteBaseRewriteRule

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /ozi-tech/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /ozi-tech/index.php [L]
</IfModule>
# END WordPress
Run Code Online (Sandbox Code Playgroud)