.htaccess网站在其他CMS和博客中的wp

时间:2013-03-16 14:53:04

标签: php wordpress .htaccess mod-rewrite

我在一个子目录中安装了Wordpress:

/的public_html /博客/

我希望能够像这样访问博客:

example.com / blog

和这样的帖子:

example.com/blog/postname

在一般设置中,我将“WordPress地址(URL)”设置为:

example.com/blog

永久链接设置如下:

example.com/blog /%postname%

在子目录(/ public_html / 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>

我在root上有另一个.httaccess用于其他CMS

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]

0 个答案:

没有答案