permalinks exclusion using .htaccess mod_rewrite
-
I did a quick search of the forums, but it seems that they’re either saying it’s no problem, or they haven’t been answered. If it’s a problem with my server, please let me know.
I’ve installed wordpress in the main root folder, and then another software as a directory underneath it:
wordpress is at: /public_html , appears as https://www.mydomain.com/
new script is at: /public_html/myscript , appears as https://www.mydomain.com/myscriptHowever, since I’m using permalinks, WordPress rewrites my urls to the wordpress index.php instead, and does not allow me to access myscript at all. Instead, it gives me a 404 error based on my wordpress template. This is appears to be the work of mod_rewrite and the .htaccess file.
Here is my original .htaccess:
# -FrontPage- IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
I understand that
RewriteCond %{REQUEST_FILENAME} !-f
andRewriteCond %{REQUEST_FILENAME} !-d
means, “if the file or the directory exists, then do not forward it to index.php (ie. wordpress)”, but if this were true, then i should have no trouble accessing /myscript/ or /myscript/index.phpHere is my attempt to write an exclusion:
RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ %{REQUEST_FILENAME} [L] RewriteCond %{REQUEST_FILENAME} -d RewriteCond %{REQUEST_FILENAME}/index.php -f RewriteRule ^ %{REQUEST_FILENAME}/index.php [L]
I’ve placed this before the #BEGIN WORDPRESS, but to no avail.
Here is my second attempt to write an exclusion:
# BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/myscript/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
Also is not working. Is there something I’m missing?
Thank you all for your time and patience.
- The topic ‘permalinks exclusion using .htaccess mod_rewrite’ is closed to new replies.