gpt4 book ai didi

php - 两个 .htaccess 两个站点

转载 作者:搜寻专家 更新时间:2023-10-31 22:08:17 26 4
gpt4 key购买 nike

我有一个自定义电子商务网站,其中有一个 .htaccess 文件。我现在正在使用 Wordpress 为其创建博客,并将其安装在名为 blog 的子目录中。

一切都很好,直到我登录到 Wordpress 管理面板并将永久链接结构更改为 %postname%。在我更改它之后,登录页面和 .htaccess 是空的。

我需要某人的帮助来检查我的 .htacess 文件并进行更改以允许 Wordpress 永久链接结构并确保它不会与主站点冲突。如果我将 Wordpress .htaccess 代码添加到底部的根 .htaccess 中,那么博客工作正常,但主站点出现 404 错误。

根 .htaccess:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^Home index.php
RewriteRule ^CompanyProfile about.php
RewriteRule ^ContactUs contact.php
RewriteRule ^Shopping-Basket inq.php
RewriteRule ^My-Account myacc.php
RewriteRule ^SiteMap sitemap.php
RewriteRule ^Terms-Conditions terms.php
RewriteRule ^Privacy-Policy privacy.php
RewriteRule ^Delivery-Information delivery.php
RewriteRule ^Returns-Policy returns.php
RewriteRule ^Disclaimer disclaimer.php
RewriteRule ^Clients clients.php

RewriteRule ^Search-Results result.php
RewriteRule ^Do-Login dologin.php
RewriteRule ^Member-Login login.php
RewriteRule ^Logout logout.php
RewriteRule ^Delete/([a-zA-Z0-9_-]+)$ delp.php?id=$1
RewriteRule ^Shopping-Basket/([a-zA-Z0-9_-]+)$ inq.php?msg=$1
RewriteRule ^ForgetPassword/([a-zA-Z0-9_-]+)$ forget.php?msg=$1
RewriteRule ^ForgetPassword forget.php
RewriteRule ^Checkout checkout.php
RewriteRule ^OrderStatus status.php
RewriteRule ^ChangePassword changepassword.php
RewriteRule ^CreateAccount/([a-zA-Z0-9_-]+)$ create.php?msg=$1
RewriteRule ^CreateAccount create.php
RewriteRule ^ChangeAccount chgaccount.php
RewriteRule ^Shipping shipping.php
RewriteRule ^SaveLogin savelogin.php
RewriteRule ^SaveOrder saveorder.php

RewriteRule ^sections/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ cproducts.php?SID=$2&MID=$1
RewriteRule ^bproducts/([a-zA-Z0-9_-]+)$ products.php?MID=$1
RewriteRule ^productdetail/([a-zA-Z0-9_-]+)$ prod_detail.php?PID=$1
RewriteRule ^products/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ bproducts.php?SID=$2&MID=$1
RewriteRule ^Details/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ large.php?PID=$3&SID=$2&MID=$1

RewriteCond %{HTTP_HOST} !^www.mydomain.co.uk$ [NC]
RewriteRule ^(.*)$ http://www.mydomain.co.uk/$1 [L,R=301

子目录/blog .htaccess:

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

最佳答案

<IfModule mod_rewrite.c> 
RewriteBase /blog/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>

关于php - 两个 .htaccess 两个站点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15458807/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com