Solved

htaccess - how to redirect to a new folder WITHOUT having that folder appear in the http path?

Posted on 2013-05-10
3
339 Views
Last Modified: 2013-05-10
Our site currently resides in the root directory established by the web host.

We've set up a new site in a subfolder of our current site called '/blog/'.

We wish to make the new site (the one in the subfolder called /blog/) the live active site so that when users enter in our domain name, it automatically takes them to our new site in the /blog/ subfolder.

BUT - we don't want the name of the subfolder to appear in the user's browser's address bar. We still want the user's address bar to simply read our domain name, and NOT contain the word '/blog/' in the path.

Is this possible with htaccess? Or do we need to ask the web host to change the default folder?

Every attempt we've made (including the one referenced on the WordPress site: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory) results in the user being directed to the '/blog/' folder but it shows '/blog/' in the path.

thanks experts!
0
Comment
Question by:rascal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
Greg Alexander earned 500 total points
ID: 39156399
Something like this should work in the root of your site in a .htaccess file

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www.)?yoursite.com$
RewriteCond %{REQUEST_URI} !^/blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /blog/$1
RewriteCond %{HTTP_HOST} ^(www.)?yoursite.com$
RewriteRule ^(/)?$ blog/index.php [L]

Open in new window

0
 
LVL 1

Author Comment

by:rascal
ID: 39156562
That worked for the homepage (index.php) of our wordpress blog, but all the other include files that reference the domain still try to find the files in the old website path. (such as .js files, css files, etc)
0
 
LVL 1

Author Closing Comment

by:rascal
ID: 39156961
Thanks, please disregard my follow-up message, your solution worked.
0

Featured Post

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question