【发布时间】:2015-02-27 23:23:17
【问题描述】:
我在堆栈上阅读了几个类似的主题,但没有一个答案能起到作用,所以:
我开始使用 Wordpress 并创建了我的第一个主题。我已将 WP 放入 localhost/first-wp/ 和 localhost/first-wp/wp-content/themes/first-theme/ 我有几个文件,例如 index.php、login.php 或 register.php。
现在,我想通过漂亮的永久链接访问这些文件,例如 localhost/first-wp/login 或 localhost/first-wp/register。
我在localhost/first-wp/ 中创建了 .htaccess 文件,并在其中放置了以下内容:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /first-wp/
RewriteRule ^index\.php$ - [L]
RewriteRule ^login? /first-wp/wp-content/themes/first-theme/login.php [QSA,L]
RewriteRule ^register? /first-wp/wp-content/themes/first-theme/register.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /first-wp/index.php [L]
</IfModule>
但问题是,当我输入例如localhost/first-wp/login 时,我收到错误:Call undefined function 'my_simple_func()' in /Applications/XAMPP/xamppfiles/htdocs/first-wp/wp-content/themes/first-theme/login.php。
这个函数当然放在我的主题目录的functions.php中。
如何解决这个问题,输入漂亮的固定链接而不出现这个错误? 感谢所有建议。
【问题讨论】: