最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

url rewriting - Wordpress dynamic page handle in theme

programmeradmin1浏览0评论

I am creating a wordpress theme

My index.php is working great

I would like only 3 urls on my website

  1. / which is going to wp-content/themes/my-theme/index.php or an ther fine I do not have problem with file name
  2. /url1 which is going to wp-content/themes/my-theme/dynamic.php
  3. /url2 which is going to wp-content/themes/my-theme/dynamic.php

I already made some intents updating the htaccess

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /wp-content/themes/my-theme/dynamic.php?path=$1 [NC,L,QSA]

But the wordpress logic is only loaded on / on the other urls I can not call wordpress functions.

I also made some tests with add_rewrite_rule but apache is returning me a 404 if I am not going to /

To sum up I would like all my urls managed by a single file then I will be doing the dispatch with php logic, this logic should also handle the root path (/)

The only url I do not want to rewrite is /wp-admin

发布评论

评论列表(0)

  1. 暂无评论