简体   繁体   中英

Wordpress subdomain integrated with existing website rewrites urls

I integrated WordPress into my existing PHP website, inside a new folder called "articole". I also created my own theme, as a twentytwelve child theme. And I added in an existing page the wordpress code to show posts for a specific category. I added in this page this line:

<?php
require('articole/wp-blog-header.php');
?>

and then I do the thing that I do also in my index page of my theme:

<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php query_posts('posts_per_page=7&category_name=blabla'); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>
(...)

This page has a name like foo_bar.php, and I have a .htaccess file that rewrites it to foo-bar/ . So all my links are towards foo-bar/ .

The problem is that when I click on a link for foo-bar/ from my index.php, it goes to articole/ (the folder where I have wordpress). It doesn't go to foo-bar/ . If I specify in the url foo_bar.php (or foo-bar/), it goes to my page successfully.

What's the matter here? Why does my "clean" link go to my wordpress blog? I should mention that I also have other pages, that don't contain wordpress code, and that are mod_rewrite (bla_foo_bar.php is re-written to bla-foo-bar/), and work. Only my page that contains WordPress code is messed up.

EDIT:

I changed my link from index.php, from foo-bar/ to foo_bar.php. Same thing happens, I get redirected to my wordpress blog...

In my case, it was a weird thing. If I had a post called "Foo bar", the page example.com/foo-bar worked. If I deleted the post, the page didn't work anymore. So my "solution" was to add articles that were named like my URLs... and hide them somewhere.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM