Mobile app version of vmapp.org
Login or Join
Samaraweera270

: WordPress .htaccess preventing subfolder access This is sort of a goofy setup, but it's not in my power to reconfigure it at this time. I'm running in a shared hosting environment. The domain

@Samaraweera270

Posted in: #Htaccess #ModRewrite #Wordpress

This is sort of a goofy setup, but it's not in my power to reconfigure it at this time. I'm running in a shared hosting environment.

The domain is example.com. This is an add-on domain on the host side with example.com being redirected to the www/example.com sub-directory. That directory houses a standard WordPress site which acts as the main site when you visit example.com.

The .htaccess file within that directory is:

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

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-admin/profile.php$ /ssm/welcome [R]
</IfModule>


I have a subdirectory, at the root level with the /example.com subdirectory that houses a CakePHP application. That subdirectory is /tracker.

My problem is that when I attempt to browse to example.com/tracker, I get a 404 from WordPress because permalinks are on. What I think I need is a rewrite rule in the WordPress .htaccess file that short circuits the existing rewrite rules and permits example.com/tracker to work independently of the WordPress install. Or a rewrite rule at the root level that short circuits the redirect to the /example.com directory in the first place.

Not sure how well I explained that so here's a summary.

The www/ directory structure:


example.com/
tracker/


Add on domain of example.com redirecting to the /example.com directory with WordPress and a tracker/ directory running CakePHP which I would like to access via example.com/tracker.
If you need further info or clarification let me know!

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Samaraweera270

2 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

You should be able to add a rewrite condition to prevent WordPress from taking over the URLs for tracker: RewriteCond %{REQUEST_URI} !tracker/

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !tracker/
RewriteRule . /index.php [L]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^wp-admin/profile.php$ /ssm/welcome [R]
</IfModule>

10% popularity Vote Up Vote Down


 

@Annie201

It's not exactly what you are looking for but... You could simply create an add-on domain for your "tracker" application. It could be exactly the same in your www/ directory, you gonna have the example.com/ and the tracker/ directory, the only difference is you gonna have to access the application with something like this : tracker.example.com/...
That could solve your problem as add-on domains are treated like independent websites inside of a domain. And i guess every shared hosting plan let you create an infinite amount of add-on domains for free :P

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme