其他教程

其他教程

Products

当前位置:首页 > 其他教程 >

Wordpress子目录下apache或nginx伪静态规则(.htaccess写法)Wellcms 子目录伪静态

GG网络技术分享 2025-03-18 16:15 2


Wellcms 子目录伪静态,Nginx下

在原有根目录伪静态的下面写入以下代码:其中wellcms是子目录名称。

location /wellcms/ {

if (!-e $request_filename) {

rewrite ^((.*)/) /wellcms/index.php last;

}

}

 

wordpress子目录下伪静态规则(.htaccess写法)

RewriteEngine on

RewriteBase /blog ;blog为子目录名字

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^.*$ ?$0

或者:

RewriteEngine On

RewriteBase /blog/

RewriteRule ^index.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /blog/index.php [L]

wordpress根目录下伪静态规则(.htaccess写法)

Options +FollowSymlinks -Multiviews

RewriteEngine On

RewriteRule ^(blog|uploadfile)(.*) - [L]

RewriteBase /

RewriteRule ^index.php$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule . /index.php [L]

这Ngnix的子目录伪静态设置如下:

具体操作的时候,替换掉www.ggplus.cn,变成你自己的子目录文件夹名即可

注:此操作适用于Nginx

location /www.ggplus.cn/ {

index index.html index.php;

if (-f $request_filename/index.html){

rewrite (.*) $1/index.html break;

}

if (-f $request_filename/index.php){

rewrite (.*) $1/index.php;

}

if (!-f $request_filename){

rewrite (.*) /www.ggplus.cn/index.php;

}

}

注意,此时前台已经伪静态成功,而后台依然不可用。报404,同样是子目录的问题,需要在后面加上下面的后台伪静态代码:

rewrite /wp-admin$ $scheme://$host$uri/ permanent;

如果后台不是wp-admin,同样要改成对应的后台目录。

标签:

提交需求或反馈

Demand feedback