Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/255.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 需要帮助了解.htaccess文件的内容吗_Php_Wordpress_.htaccess - Fatal编程技术网

Php 需要帮助了解.htaccess文件的内容吗

Php 需要帮助了解.htaccess文件的内容吗,php,wordpress,.htaccess,Php,Wordpress,.htaccess,我正在用Wordpress写博客,我不知道它创建的.htaccess文件在做什么 以下是该文件的内容: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /welg/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRul

我正在用Wordpress写博客,我不知道它创建的.htaccess文件在做什么

以下是该文件的内容:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /welg/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /welg/index.php [L]
</IfModule>
# END WordPress
#开始WordPress
重新启动发动机
重新编写基础/welg/
重写规则^index\.php$-[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/welg/index.php[L]
#结束WordPress
明白这一点的人有时间向我解释每一行吗?任何帮助都将不胜感激。

#如果mod_rewrite.c模块可用,请执行以下操作
# If the mod_rewrite.c module is available then do the following
<IfModule mod_rewrite.c>

    # Enable the rewrite engine, which is used to rewrite the
    # path to something WordPress understands
    RewriteEngine On

    # Set the base to this path. In other words, assume that the
    # website is always at domain.com/welg/
    RewriteBase /welg/

    # If index.php is called then stop rewriting ([L] means Last)
    RewriteRule ^index\.php$ - [L]

    # If the path is NOT a valid file
    RewriteCond %{REQUEST_FILENAME} !-f

    # ... and the path is NOT a valid folder
    RewriteCond %{REQUEST_FILENAME} !-d

    # ... then always load the index.php file (which will handle
    # loading the page, no matter what the path is)
    RewriteRule . /welg/index.php [L]

# Done
</IfModule>
#启用重写引擎,该引擎用于重写 #通往WordPress理解的道路 重新启动发动机 #将基准设置为此路径。换句话说,假设 #网站始终位于domain.com/welg/ 重新编写基础/welg/ #如果调用index.php,则停止重写([L]表示最后一次) 重写规则^index\.php$-[L] #如果路径不是有效的文件 重写cond%{REQUEST_FILENAME}-F # ... 路径不是有效的文件夹 重写cond%{REQUEST_FILENAME}-D # ... 然后始终加载index.php文件(该文件将处理 #加载页面,无论路径是什么) 重写规则/welg/index.php[L] #完成


重新启动发动机
重写基/
重写规则^index\.php$/welg/index.php[L]
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则/welg/index.php[L]

如果我在welg目录中有wp的所有文件,并且我想要url
http://domain.com
那么需要更改哪些内容。htaccess@Irfan请参阅更新的答案。我相信这样就可以了。太棒了-WP处理404,底部有条件。我更愿意尝试帮助访问者找出他们误入歧途的地方,并记录错误,以便管理员及时处理。WP使用404页面的唯一时间是当请求的博客文章不存在时。我已经测试了很多东西,这是唯一的404可湿性粉剂照顾。我想给来访者更多的帮助。非常感谢你!啊-有没有办法在这样的评论中换行?我发现大块的文字有点难读。空白有它的位置。@SimonT我很确定htaccess文件只支持单行注释(
#注释
)。不支持新行。只需使用多个单行注释即可。对不起,我确实澄清了我的意思-我想在stackoverflow的问题注释中插入空行-将我现在键入的注释行。
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ /welg/index.php [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /welg/index.php [L]
</IfModule>