WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Create subfolder, not affected by WordPress (2 posts)

  1. jamiek22
    Member
    Posted 7 months ago #

    Hello.

    I have a WordPress site installed in the root. I have added an online store to this site, independent of WordPress, installed in a subfolder called /shop. Inside /shop is an .htaccess file and an index.php, which together parse the URL to figure out which category to show products from, eg:

    http://www.mysite.com/shop/clothes
    http://www.mysite.com/shop/shoes
    http://www.mysite.com/shop/hats

    These URLs display just fine, but a 404 is returned in the header causing problems with Google. In my /shop/index.php file I tried manually outputting the header with status 200, but it didn't fix the problem. When I look at the headers it looks like WordPress is trying to render the page first, which fails (i.e. /.htaccess is firing and doing whatever it wants to with /shop/clothes). I think that because of the "X-Pingback" line.

    Here is the request header:

    GET /shop/clothes/ HTTP/1.1
    Host: www.mysite.com
    User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0
    Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    Accept-Language: en-US,en;q=0.5
    Accept-Encoding: gzip, deflate
    Referer: http://www.mysite.com/shop/
    Cookie: __utma=152555369.2028364656.1389216381.1389279043.1389294490.4; __utmz=152555369.1389216381.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); wp-settings-1=editor%3Dtinymce%26hidetb%3D1%26libraryContent%3Dbrowse%26urlbutton%3Dnone%26wplink%3D1; wp-settings-time-1=1389277270; PHPSESSID=2df7073e57934fd781ab27c1c7b74245; __utmb=152555369.34.10.1389294490; __utmc=152555369; wordpress_test_cookie=WP+Cookie+check; wordpress_logged_in_b2aba7eb0409bbc11fbbc4c2403dc2dc=admin%7C1389471226%7Cc07f299f80fe0ac1b15598636b08f66f
    X-LogDigger-CliVer: client-firefox 2.1.7
    X-LogDigger: logme=0&reqid=f7a4f2ac-3cfc-4a63-94e6-0b9233c7dfe6&
    Connection: keep-alive

    Here is the response header:

    HTTP/1.1 404 Not Found
    Date: Thu, 09 Jan 2014 20:21:23 GMT
    Server: Apache/2.2.22 (Unix) mod_ssl/2.2.22 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_perl/2.0.5 Perl/v5.8.8
    X-Powered-By: PHP/5.3.13
    X-Pingback: http://www.mysite.com/xmlrpc.php
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    Keep-Alive: timeout=5, max=100
    Connection: Keep-Alive
    Content-Type: text/html; charset=UTF-8
    Content-Length: 14381

    Any suggestions how I can get my subfolder to not be rendered by WordPress first? I cannot create subfolders and index.php for each of "clothes", "shoes", "hats" as it is dynamically driven by a database. Thanks,

    Jamie

  2. jamiek22
    Member
    Posted 7 months ago #

    I've found the problem, I was stuck on .htaccess but it was not the issue.

    To test whether WordPress indeed wass causing it I renamed /.htaccess to /.htaccesxxx. On /shop/index.php the 404 header was still coming up meaning the problem was in my code. At the top of my file I had these two lines, to include the WordPress template's header HTML:

    require __DIR__ . '/../wp-blog-header.php';
    get_header();

    Tracing through get_header() I could see it was throwing the 404. I had to remove these 2 lines and find another way to display the header.

    Hope this helps someone down the road.

Reply

You must log in to post.

About this Topic