Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress htaccess in root overriding htaccess in subdomain. Subdomain app not working now

We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests.

So, how to I eliminate the WP htaccess file from effecting the subdomain?

Here is the htaccess contents for the root (WP install):

<IfModule mod_rewrite.c>
RewriteEngine On
# BEGIN WordPress
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
</IfModule>

And for the htaccess in the subdomain:

RewriteEngine on
RewriteCond $1 !^(index\.php|css|stylesheets|js|images|user_guide|favicon\.ico|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

I've search everywhere online and tried a couple samples I found.. nothing has worked.

Any help is greatly appreciated ! Thanks

UPDATE: It seems that maybe Wordpress is not the culprit.. out of curiosity, I removed all lines in the WP .htaccess file.. and the app in the subdomain was still not working. Its rewrite rule must be wrong..

So, it is the second rewrite rule that is not working. If I type in /index.php?about then I can see the about page.. but it should display by going to: /about

like image 466
revive Avatar asked Apr 18 '10 05:04

revive


People also ask

How do I regenerate htaccess in WordPress?

Since you've already deactivated the old WordPress . htaccess file, you can use File Manager to create a new file named . htaccess . Simply edit this newly created file, paste in the default code from above, and you've now regenerated your .

Does WordPress overwrite htaccess?

By default, depending on file permissions, WordPress automatically will modify the contents of your site's . htaccess file. It does this on several occasions, adding and/or updating the rewrite rules required for WP's permalink functionality.

What is the default WordPress .htaccess file?

In WordPress, the default . htaccess file is mainly used to handle permalinks to pages on your WordPress website. However, as a configuration file, you can also add additional configuration options to adjust the behavior of your website, such as: URL redirects and rewriting.

Why can't I find htaccess file on my WordPress site?

htaccess file is located in the root directory of your WordPress site. Depending on your hosting provider, the root directory may be a folder labelled public_html, www, htdocs, or httpdocs. You can locate it by using File Manager in your hosting account's cpanel.


1 Answers

WP is also the culprit (you have two problems).

I can fix the first .htaccess problem because WP is predictable. You want to put this before the BEGIN WordPress section:

RewriteRule ^subdir-name/.*$ - [PT]

That grabs any requests to your subdir and Passes it Through (PT) so that it is not hijacked by WordPress.

The problem in your second .htaccess is that it seems to be assuming it is still in the root directory. For this one, I can't be sure without seeing the layout of your app, but the / before index.php may well be wrong. Are you sure that the paths in the second file match the new layout of your files?

like image 109
Nicholas Wilson Avatar answered Nov 15 '22 05:11

Nicholas Wilson