添加RewriteURL页面

时间:2016-08-30 13:42:48

标签: php wordpress .htaccess

我正在尝试将文件 recipes.php 的页面添加到现有的WordPress网站 sea-horse.org 。我需要以 sea-horse.org/recipes 中提供的格式访问 recipes.php

如何编辑现有的WordPress .htaccess 文件:

# BEGIN A2 Optimized 
# DO NOT REMOVE 
<IfModule mod_rewrite.c> 
   RewriteEngine On RewriteRule wp-content/plugins/a2-optimized/resource/(.*) wp-  content/a2-resource.php?resource=$1 [L] 
</IfModule> 

ErrorDocument 403 /403.shtml 
# END 

A2 Optimized 

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

# END WordPress –

2 个答案:

答案 0 :(得分:0)

您无法在Wordpress管理员中编辑.htaccess文件。您需要使用像Aptana这样的IDE对其进行编辑,或者使用FileZilla等FTP客户端进行下载,进行更改并上传回服务器。

答案 1 :(得分:0)

您可以转到主题文件夹,然后复制page.php中的recipes.php,然后复制recipes.php的顶部,只需添加以下内容

/* Template Name: Recipes Page */

之后只需转到后端区域并创建一个新页面。在此案例recipes中命名要在slug中使用的页面,并从新页面区域的侧栏中选择Recipes Page作为页面模板。之后,您可以使用该页面上所需的代码修改代码。