老薛主机云主机如何启用伪静态

如何启用伪静态?

老薛主机所有云主机都支持伪静态,不需要特别的设置。只需要在自己的网站后台启用伪静态,之后将网站程序提供的伪静态规则复制到对应网站根目录下的 .htaccess 文件中,或者将含有伪静态规则的 .htaccess 文件上传到对应的网站根目录下就可以了。

如果对应网站程序文件的根目录下没有 .htaccess 文件,程序商也没有提供伪静态规则,我们建议联系程序开发商提供(或使用搜索引擎搜索)对应程序在 Apache 环境下使用的伪静态规则。

如何编辑或创建 .htaccess 文件?

在 Linux 系统中,点开头的文件通常属于系统文件,这些文件是隐藏文件。显然 .htaccess 就是一个隐藏文件,在 cPanel 面板的文件管理器中,需要选择显示隐藏文件才能查看和编辑这个文件。如果设置了显示隐藏文件之后,仍然看不到这个文件,就需要自己创建一个,具体可以参考下面的教程:

常见程序的伪静态规则

WordPress

WordPress 程序在网站后台设置了固定连接之后,程序会自动配置 .htaccess 文件,自动配置伪静态规则,无需自己编辑 .htaccess 文件。

# BEGIN WordPress

RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

# END WordPress

Typecho

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

Z-Blog

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

ThinkPHP

<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php?s=/$1 [QSA,PT,L]
</IfModule>

Discuz X3

RewriteEngine On
RewriteBase /

RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^topic-(.+)\.html$ portal.php?mod=topic&topic=$1&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^article-([0-9]+)-([0-9]+)\.html$ portal.php?mod=view&aid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^forum-(\w+)-([0-9]+)\.html$ forum.php?mod=forumdisplay&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^thread-([0-9]+)-([0-9]+)-([0-9]+)\.html$ forum.php?mod=viewthread&tid=$1&extra=page\%3D$3&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^group-([0-9]+)-([0-9]+)\.html$ forum.php?mod=group&fid=$1&page=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^space-(username|uid)-(.+)\.html$ home.php?mod=space&$1=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^blog-([0-9]+)-([0-9]+)\.html$ home.php?mod=space&uid=$1&do=blog&id=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^archiver/(fid|tid)-([0-9]+)\.html$ archiver/index.php?action=$1&value=$2&%1
RewriteCond %{QUERY_STRING} ^(.*)$
RewriteRule ^([a-z]+[a-z0-9_]*)-([a-z0-9_\-]+)\.html$ plugin.php?id=$1:$2&%1

苹果 CMS v10

<IfModule mod_rewrite.c>
Options +FollowSymlinks -Multiviews
RewriteEngine on

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

1 Star2 Stars3 Stars4 Stars5 Stars (无评分)
Loading...

分类:Cpanel控制面板 |

在线客服

QQ客服

微信客服