So I have WordPress installed in /wp/
but I want all WordPress URLs to be rewritten to appear in the root directory. I currently have this working (see below) but I want to change my .htaccess
so it doesn't break other subdirectories.
For example, if I want to visit www.example.com/images/image.png
, it currently reroutes me to a 404 page on WordPress.
Is this even possible with .htaccess
?
Current code:
RewriteEngine on
#Wordpress
# Rewrites all URLS without wp in them
RewriteCond %{REQUEST_URI} !^/wp/
# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?example\.
# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /wp/$1 [L]
Update: Tested MrWhite's suggestion with Incognito mode and a second browser. No effect. New .htaccess
file:
RewriteEngine on
#Wordpress
# Rewrites all URLS without wp in them
RewriteCond %{REQUEST_URI} !^/wp/
# Rewrites all URLS [Replace "example" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?example\.
# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /wp/$1 [L]
# Request does not map to an existing file
RewriteCond %{REQUEST_FILENAME} !-f```f