redirect sub-folder to root directory

Hi does anyone know how to redirect from a subdirectory or sub-folder to root directory?...without it affecting dolphin ie uploads etc.

I have my site in a sub directory ie http://www.mysite.com/folder

and id like it to show http://www.mysite.com

Quote · 23 Aug 2008

Hi Kosmic!

 

I'm not sure if I understand the situation correctly. So, your script is installed in a subdirectory.. right?.. Now, you want it to show as you root directory.. example: when someone types http://www.mysite.com, you want the script index page to appear?

 

If that's the case, you'll need to redirect your index page (in the root directory) to your script location.. example: redirect mysite.com to mysite.com/folder.

 

If I misunderstood, please tell us more about what exactly that you need done.

 

Hope this helps.

Quote · 23 Aug 2008

Kosmic,
If you have cpanel for your hosting, go to redirects and redirect there.
example: Add Redirect: http://yourdomain/   redirected to>  http://yourdomain/folder
Similar for other panels  ..... 


Cloodo  .....  regarding your post:
Where are you going to put your redirect command?
.

Quote · 23 Aug 2008

 

Kosmic,
If you have cpanel for your hosting, go to redirects and redirect there.
example: Add Redirect: http://yourdomain/   redirected to>  http://yourdomain/folder
Similar for other panels  ..... 


Cloodo  .....  regarding your post:
Where are you going to put your redirect command?
.

 

 

I wouldnt manusally put a command.. I would just do the redirect on cpanel like I said above.. Just redirect index (in the public_html) to the folder where the script is sitting.

 

"..If that's the case, you'll need to redirect your index page (in the root directory) to your script location.. example: redirect mysite.com to mysite.com/folder.."

Quote · 23 Aug 2008

kosmic,

may i ask why you dont just move the install to root? a 301 may (may) deter your site from being indexed by the search engines.

later,

DosDawg

When a GIG is not enough --> Terabyte Dolphin Technical Support - Server Management and Support
Quote · 23 Aug 2008

I already have setup in the control panel a redirect from www.mysite.com to www.mysite.com/folder, reason being its on hostmonster ( in incubation ) and there are other sites setup on the server so it keeps it tidy.

I was thinking of using a htaccess file to rewrite it so it removes the folder from being viewed.

Fussy i know but i like things tidyish.

is this achievable with htaccess?....or will it conflict?

Quote · 23 Aug 2008

you really dont even have to do that in .htaccess but it is something you can do, and that is what the redirect in cpanel should  do for you.

you can write a simple redirect script set it as html and point it to the subdirectory that you are wanting to serve.

<meta
http-equiv="refresh" content="0; url=your new address.html">

create a blank .html file, add this to the head of that file it will send your guests who call up http://yourdomain.com to http://yourdomain.com/subdirectory. now if you are not happy with that, you can in htaccess write a rewriterule that will then in turn take http://yourdomain.com/subdirectory and serve it as being http://yourdomain.com/

hope that loop makes sense to you.

later,
DosDawg

When a GIG is not enough --> Terabyte Dolphin Technical Support - Server Management and Support
Quote · 23 Aug 2008

my site already redirects from www.mysite.com to www.mysite.com/subfolder... this was setup ages ago on cpanel.

what i need is to hide the /subfolder without moving the whole site to root.

For example..... this is what im trying to achieve (but obvs not drupal)

i have already tried implimenting various htaccess methods to no avail, if you have read through the link you'l notice they mention shortening the site url in (drupal) settings.php to just the main domain name....which the equivilent to us should be in header.inc.php i have also amended this and that didnt work as all the rewrite rules for dolphin in my installation folder htaccess wont work (unless as a guess i manually go through them and add in the subfolder name)

So basically ive followed that guide (and a few others lol) and changed it to suit my needs, drank several coffee's inbetween and am back to square 1.

hmmmm so am i wasting my time?....should i leave it be for now?.. as everything would be resolved when i move it to vps.

Quote · 24 Aug 2008

 

my site already redirects from www.mysite.com to www.mysite.com/subfolder... this was setup ages ago on cpanel.

 

what i need is to hide the /subfolder without moving the whole site to root.

 

 

For example..... this is what im trying to achieve (but obvs not drupal)

 

i have already tried implimenting various htaccess methods to no avail, if you have read through the link you'l notice they mention shortening the site url in (drupal) settings.php to just the main domain name....which the equivilent to us should be in header.inc.php i have also amended this and that didnt work as all the rewrite rules for dolphin in my installation folder htaccess wont work (unless as a guess i manually go through them and add in the subfolder name)

 

So basically ive followed that guide (and a few others lol) and changed it to suit my needs, drank several coffee's inbetween and am back to square 1.

 

hmmmm so am i wasting my time?....should i leave it be for now?.. as everything would be resolved when i move it to vps.

 

 

 

 

 

 

 

 

 

Kosmic, it looks like what you need is a clean url. Here's another thought, why not create a subdomain (the subdirectory where the script is installed) and redirect to the root directory applying clean url. Here's something that might be worth looking at to help you achieve this:

 

http://www.bluehostforum.com/archive/index.php/t-288.html

 

 

Quote · 24 Aug 2008

By the way, that thread discusses solutions to redirect parked domains but it should also be ok for subdomains on the same server.

 

Cheers.

Quote · 24 Aug 2008

I have made the following changes in .htaccess file (in public_html directory):

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

Now it's redirect me and not showing the subfolder just www.yourdomain.com. The only problem is I have no idea how to configure header.inc.php in site address and admin path! Anybody got ideas? Hope this will work for all of you when we get proper path ;)

Quote · 1 Jun 2009

Did you try
RewriteRule ^(.*)$ /$2/$1 [L]

HTH
.

Quote · 2 Jun 2009

I have made the following changes in .htaccess file (in public_html directory):

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

Now it's redirect me and not showing the subfolder just www.yourdomain.com. The only problem is I have no idea how to configure header.inc.php in site address and admin path! Anybody got ideas? Hope this will work for all of you when we get proper path ;)

If your trying to achive the same thing iwas a while ago my blog post at boonexnerd.com might help.

http://www.boonexnerd.net/dolphin/blogs/posts/kosmic

Quote · 2 Jun 2009

I have made the following changes in .htaccess file (in public_html directory):

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

Now it's redirect me and not showing the subfolder just www.yourdomain.com. The only problem is I have no idea how to configure header.inc.php in site address and admin path! Anybody got ideas? Hope this will work for all of you when we get proper path ;)

If your trying to achive the same thing iwas a while ago my blog post at boonexnerd.com might help.

http://www.boonexnerd.net/dolphin/blogs/posts/kosmic

Looking really great I will give a try, thank you kosmic! ;)

Quote · 2 Jun 2009
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.