Support » Installing WordPress » htaccess real folder with virtual files / entries

  • Resolved sometimesalarmed


    I’m trying to do something with .htaccess and WordPress that I imagined to be straightforwards but is proving to be anything but (for me at least).

    I have a scenario where I want to use .htaccess / httpd.conf to allow the server to have a real folder, but still serve WordPress entries from it.

    In bullet point we’d have the following URLS:

    • /
    • /folder/real-file.php
    • /folder/virtual-file-1.html

    In this:

    • / is the WordPress install point
    • /folder/ is a folder that actually sits on the server. It is also set up as a ‘category’ in WordPress. When the folder doesn’t exist, WordPress can server it fine
      real-file.php is a file that sits within /folder/ It’s PHP and if a browser points to it I want it to display / process
    • virtual-file-1.html is a WordPress entry, with it’s URL rewritten and -1 as it’s unique ID

    I’m using the following permalink structure:

    • /%category%/%postname%-%post_id%.html – category
    • %category% – category base

    I’ve tried creating some Rewrite conditions and rules around this. However, they all result in the same scenario (unless they kill everything together):

    • /folder/real-file.php displayd fine
    • /folder/virtual-file-1.html results in a 404
    • /folder/ results in a 403 forbidden (there is no index.php etc… in it)
      When the last two are called up, however, I’d like it to call up WordPress’ index.php thus generating the directory view or the blog entry

    I’ve tried the following .htaccess entries (and quite a few more) all with the same result:

    RewriteRule ^folder/index2.\php$ - [NC,L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L] 
    RewriteCond %{REQUEST_URI} ^/folder/index2\.php [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L] 
    RewriteCond %{REQUEST_URI} !/beauty/index2.\php$
    RewriteRule . /index.php [L]

    Any suggestions for where I might be going wrong in this quest?

    Thanks 🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘htaccess real folder with virtual files / entries’ is closed to new replies.