The Joomla! Forum ™



Forum rules


Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.



Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Wed Nov 04, 2009 12:35 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Nov 04, 2009 12:22 am
Posts: 2
Hi folks,

I'd like to pipe in with the solution I'm using that I think addresses the needs expressed -- forgive me if I'm wrong. I'm new to Joomla but am thoroughly enjoying learning about it.

The desire was expressed for a solution that both masks the subdirectory installation of Joomla and also allows for the access of other subdirectories on the website's domain.

I've installed Joomla on my domain in the "/j/" subdirectory. Here's the contents of my .htaccess file from the root of my domain:

Code:
#These first two lines might already be in the file - no need to repeat
Options +FollowSymlinks
RewriteEngine on

# Redirect to the Joomla root folder
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^(index\.html)?$ http://www.domain.com/j/ [R=301]

# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$

# Only apply to URLs that aren't already under folder
RewriteCond %{REQUEST_URI} !^/j/

# Don't apply to URLs that go to existing files or folders
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Rewrite all those to insert /j
RewriteRule ^(.*)$ /j/$1 [L]


Additionally, my "live_site" variable from my /j/configuration.php file reads as:

Code:
var $live_site = 'http://www.domain.com';


At one point I was combating a problem where domain.com would provide normal access to the website but http://www.domain.com would provide content only -- no CSS or images, but these settings, along with my webhost's control panel setting or redirecting all domain.com traffic to http://www.domain.com seem to have solved it.

I've tested all approaches to the website and new subdirectories and it all seems to work.

Hope that helps someone!


Top
 Profile  
 
PostPosted: Wed Nov 04, 2009 5:27 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Nov 04, 2009 12:22 am
Posts: 2
Argh, seems I spoke too soon.

It seems that Internet Explorer doesn't like these changes -- the site became unreachable after I implemented these changes -- but only in IE. I'm sure that comes as an enormous surprise to everyone, right?

Any gurus out there that can figure out how to correct the IE specific issue?


Top
 Profile  
 
 Post subject: Doesn't work in IE
PostPosted: Fri Nov 20, 2009 5:43 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Apr 26, 2009 6:11 pm
Posts: 21
Yeah I'm having the same problem. My post earlier works perfectly in Firefox and Safari, but not IE. If anyone has any idea what could cause this, please let me know. I've been working on this on and off for months.

thanks


Top
 Profile  
 
PostPosted: Wed Mar 17, 2010 2:30 am 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jun 04, 2007 1:53 pm
Posts: 47
Location: columbus ohio
OOOkay. My post was deleted and no reason was given.

Let me try again.

This does not work with Joomla search. It returns a 404 error. (the first rewrite solution posted)

The 2nd one doesn't seem to work at all for me so far.

(The last time I posted a image of the error so I will try to reply without the image in hopes I dont get deleted again, even though additional information might be useful.)


Top
 Profile  
 
PostPosted: Wed Mar 17, 2010 6:41 pm 
User avatar
Joomla! Master
Joomla! Master

Joined: Sun Oct 02, 2005 12:50 am
Posts: 18755
Location: Omaha, NE
columbusgeek wrote:
OOOkay. My post was deleted and no reason was given.
columbusgeek wrote:
(The last time I posted a image of the error so I will try to reply without the image in hopes I dont get deleted again, even though additional information might be useful.)


I reviewed all of the moderator logs from 10 am on the 16th to after your post here at 20:30. No post of yours was removed. You sure you actually saved it? The moderators do not arbitrarily remove posts and unless it is a duplicate post you would get a board warning for forum rules violation and even with duplicate posts if you are a frequent violator of the forum rules you would also get a warning. Images about issues are not cause for a post removal. Perhaps it would be helpful if you familiarized yourself with the forum ruleshttp://forum.joomla.org/viewtopic.php?f=8&t=65.

_________________
Regards, Dave
http://www.kiwaniswest.org


Top
 Profile  
 
PostPosted: Wed Mar 17, 2010 7:45 pm 
User avatar
Joomla! Apprentice
Joomla! Apprentice

Joined: Mon Jun 04, 2007 1:53 pm
Posts: 47
Location: columbus ohio
Dunno Dave. I had it open in a tab and refreshed it off and on throughout the day for responses. Then near the end of the day it disappeared. I know I pressed submit as I do not use the save option and phpBB tends to have the buttons in a odd spot so I take care to press the right one.

*shrugs*

back on topic.


Top
 Profile  
 
PostPosted: Sat Mar 20, 2010 4:03 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Thu Nov 22, 2007 7:27 pm
Posts: 12
I would like to use this trick as well. From an admin standpoint it makes things a lot easier to manage. However i am running into an issue, soon as a evoke the above code, when I go to the site it then gives me a 403 error. I am using the supplied joomla htaccess.txt any ideas?

Code:
########## Begin - Joomla! core SEF Section
#
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/index.php
RewriteCond %{REQUEST_URI} (/|\.php|\.html|\.htm|\.feed|\.pdf|\.raw|/[^.]*)$  [NC]
RewriteRule (.*) index.php
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
#
########## End - Joomla! core SEF Section

#Need to redirect from the OLD site or missing www. before the domain.
RewriteCond %{HTTP_HOST} ^domain.com [NC,OR]             
RewriteCond %{HTTP_HOST} \.net$                           
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]   


Top
 Profile  
 
PostPosted: Fri Sep 10, 2010 12:12 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Dec 18, 2008 4:04 am
Posts: 2
The two files below work for me. I an hosted on GoDaddy and xover15's suggestion did not work for me. However, I got the idea from "him" that I needed to split the .htaccess files. The rewrite of the url in the root and the security issues specific to Joomla in /joomla.
Attachment:
htaccess for inside Joomla subdirectory.txt

Attachment:
htaccess in root generic.txt


You do not have the required permissions to view the files attached to this post.


Top
 Profile  
 
PostPosted: Thu Nov 04, 2010 10:48 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Thu Nov 04, 2010 10:01 pm
Posts: 2
I have problem with my domain to route to a subdirectory.
I have felt all the tips listed here, but no luck.

My problem is the following:
My main domain is www.domain.com, but Joomla was installed in the folder (www.domain.com / Joomla) and htaccess.txt (not .htaccess) file is located under the "Joomla" folder. I've tried all sorts of tips that are on this page but could not get it.

Is there any one can help me to get this to work. This is an urgent matter.


Top
 Profile  
 
PostPosted: Thu Dec 16, 2010 2:53 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Jul 15, 2009 9:22 pm
Posts: 2
dhstarr wrote:
The two files below work for me. I an hosted on GoDaddy and xover15's suggestion did not work for me. However, I got the idea from "him" that I needed to split the .htaccess files. The rewrite of the url in the root and the security issues specific to Joomla in /joomla.
Attachment:
htaccess for inside Joomla subdirectory.txt

Attachment:
htaccess in root generic.txt



After reading through this whole thread I thought I understood what needed to be updated. So I used the above two file, edited them to use my domain and the initial re-direct works. But if I click on any article I get server error.

I tried updating my configuration.php as instructed above in this tread but this hasn't worked.

Does any know what the problem could be?

Thanks


Top
 Profile  
 
PostPosted: Fri Dec 17, 2010 5:08 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed Jul 15, 2009 9:22 pm
Posts: 2
Does anyone have any advice on the above post. Just can't work out what the issue is.


Top
 Profile  
 
PostPosted: Thu Apr 28, 2011 8:32 am 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Nov 12, 2010 3:25 am
Posts: 17
@Super Will

Yeah ... only 5 months later and hopefully you're up and running now. However, for benefit of others ...

I use a sub-directory for the joomla installs as well ... migration path from dev->test->production as well as simply a much cleaner, compartmentalized, directory structure - ie Joomla is not the *entire* website. But I digress.


- The split method of the htaccess files dhstarr mentions above works like a charm. One htaccess for the "host root" directory and another in the "joomla root" (plus a configuration.php live_site change)

To answer why it may not have taken effect may be due to cached data.
- Try using "Tools->Clean Cache"

... can pretty much delete everything because making the above changes means the URLs for files are all changed anyway (or might be maybe could may have possibly would have been will be changing - it's anybody's guess)

{edit}
May also what to look at vashanka's post on 9.9.2008 on the thread (viewtopic.php?p=1459424) regarding SEF configuration. It all goes hand in hand.

In this case we want to "hide" the extraneous sub-directory parts from the visitors and it's more friendly (and a semi-security benefit). In the SEF thread it's about making the URLs friendly to other machines (well, ok, bot software).


Top
 Profile  
 
PostPosted: Wed May 18, 2011 5:50 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Wed May 18, 2011 5:12 pm
Posts: 1
Hello, I am new to Joomla. I only started playing with it this week. I have been reading the book Joomla for Dummies by Seamus Bellamy. So far I have installed it locally on my local Macintosh. I plan to install it on a remote host soon.

Anyway, while installing on my local machine I put Joomla in directory joomla. So I access it as http:// localhost/joomla

Like others in this thread, this concerned me. We want the Joomla files in their own directory for neatness because we need to have other directories and files in the root or it will be just a complete mess. But we also want the Joomla website to be at the root http:// localhost/ (or http://here-look.com/ when it is on the remote host) so that we can tell people to just go to http://here-look.com

Instead of messing with .htaccess files, I put an index.php file in root that has a require() satement that calls joomla/index.php

Code:
<?php
/* Short and sweet */

require('joomla/index.php');
?>


This is like an include() statement and causes php to evaluate the file. When I accessed http:// localhost/ it got all the menus and such, but none of the formatting. After reading this thread, I edited my joomla/configuration.php file to define the config variable $live_site

Code:
public $live_site = 'http://localhost/joomla';


This seems to work.
1. Joomla is in its own directory, joomla
2. I can access the website as http:// localhost/
3. The address bar does show http:// localhost/joomla/... for pages, but I don't see that as a problem

I haven't tried this yet on a remote host. Does anybody see a drawback to this approach? It seems like a very simple and easy solution. Also, it works if you have a webhost that doesn't allow users to have .htaccess files

_________________
http://here-look.com/


Top
 Profile  
 
PostPosted: Thu Nov 10, 2011 6:34 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jul 13, 2010 2:20 am
Posts: 3
Based on a suggestion posted earlier:
*********************************************************
It is best for SEO purposes to use the redirect command in the in the .htaccess file. There are plenty of sound reasons for doing this rather than by domain forwarding or other methods. Just do a search on .htaccess file and redirect.

The command is:
Redirect /index.html http://www.yourdomain.ext/htdocs
assuming you put your Joomla files in subdirectory htdocs.

# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)
#RewriteBase /htdocs/
to
RewriteBase /subdirectory-name/
*********************************************
Questions I have:
1. My htaccess file is in the subdirectory (www.mywebsite.com/myjoomla). So how does editing this file which is in a subdirectory redirect someone who types www.mywebsite.com to my subdirectory?
2. Just fyi, my root directory has a home.htm file, that's it.


Top
 Profile  
 
PostPosted: Fri Jan 27, 2012 7:38 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Sep 07, 2007 3:54 am
Posts: 47
I installed Joomla in my root directory, then, i needed to install a wordpress in a subdirectory called "blog".
I can access mydomain.com/blog but when i click in a post, give a joomla error page.
What is the best practice to my case?
Install Joomla in a "portal" subdir, and Wordpress in other subdir called "blog" and then chenge .htaccess of my root folder to hide the "portal" folder when someone access my site? Because the Joomla will be my homepage and I want hide the subdir "portal".


Top
 Profile  
 
PostPosted: Mon Oct 22, 2012 1:11 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Mon Oct 22, 2012 1:01 am
Posts: 1
pictorpub wrote:
Hello, I am new to Joomla. I only started playing with it this week. I have been reading the book Joomla for Dummies by Seamus Bellamy. So far I have installed it locally on my local Macintosh. I plan to install it on a remote host soon.

Anyway, while installing on my local machine I put Joomla in directory joomla. So I access it as http:// localhost/joomla

Like others in this thread, this concerned me. We want the Joomla files in their own directory for neatness because we need to have other directories and files in the root or it will be just a complete mess. But we also want the Joomla website to be at the root http:// localhost/ (or http://here-look.com/ when it is on the remote host) so that we can tell people to just go to http://here-look.com

Instead of messing with .htaccess files, I put an index.php file in root that has a require() satement that calls joomla/index.php

Code:
<?php
/* Short and sweet */

require('joomla/index.php');
?>


This is like an include() statement and causes php to evaluate the file. When I accessed http:// localhost/ it got all the menus and such, but none of the formatting. After reading this thread, I edited my joomla/configuration.php file to define the config variable $live_site

Code:
public $live_site = 'http://localhost/joomla';


This seems to work.
1. Joomla is in its own directory, joomla
2. I can access the website as http:// localhost/
3. The address bar does show http:// localhost/joomla/... for pages, but I don't see that as a problem

I haven't tried this yet on a remote host. Does anybody see a drawback to this approach? It seems like a very simple and easy solution. Also, it works if you have a webhost that doesn't allow users to have .htaccess files


I had to create an account here just so I can post the praise that this worked perfectly and flawlessly. I am using Joomla 2.5.7 on a linux virtual host. I tried messing around with URL redirect in cpanel and .htaccess file. Somehow I screwed up my host and any php file would give error 500. I put everything back to normal but it still would not work. I had to get admins to fix it.

The option you provided was quick and easy and does exactly what I need.... To make mainsite.com redirect to mainsite.com/joomla

Many thanks.

(EDIT) I went to mysite.com/joomla/administrator. I got the login page, but when I logged in, it sent me to localhost/joomla/administrator and page not found.

I changed config file line from localhost to mysite.com

Now it is perfect!

[Mod Note: Only probably being you are posting to the 1.5 Forum about a 2.5 issue. ]


Top
 Profile  
 
PostPosted: Sun Jun 29, 2014 1:42 am 
User avatar
Joomla! Intern
Joomla! Intern

Joined: Thu Aug 17, 2006 4:19 am
Posts: 70
Location: Kingwood TX
Old post, but this thread is what comes up when searching for solutions to rewrite a subdirectory installation to the root.

After several different attempts, I found a solution that will rewrite the urls to the root, excluding certain subdirectories, that still works when sh404SEF is enabled and installed.

The instructions reference Joomla 1.0 and 1.5, but I'm running 3.3.1 and it works.

Step 1

Add this code to the root htaccess file.

Code:
Options -Indexes +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
# Include in the next line all folders to exclude

RewriteCond %{REQUEST_URI}  !(folder1|folder2) [NC]
RewriteCond %{REQUEST_URI} !^/joomla/

# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /joomla/$1 [L]


Step 2

Set the livesite variable in joomla/configuration.php to mysite.com

Step 3

Add a file called index.php (which is what VirtualO suggested) to the root which includes this code:

Code:
<?php
include('joomla/index.php');
?>


Reading the different instructions given across the web, it looks like what will work with one host won't necessarily work with another, so I guess I should note that this is on a Hostgator server.


Top
 Profile  
 
PostPosted: Tue Aug 12, 2014 2:45 pm 
User avatar
Joomla! Explorer
Joomla! Explorer

Joined: Sat Jun 09, 2012 10:58 am
Posts: 384
Location: Imphal
cma01 wrote:
Old post, but this thread is what comes up when searching for solutions to rewrite a subdirectory installation to the root.

After several different attempts, I found a solution that will rewrite the urls to the root, excluding certain subdirectories, that still works when sh404SEF is enabled and installed.

The instructions reference Joomla 1.0 and 1.5, but I'm running 3.3.1 and it works.

Step 1

Add this code to the root htaccess file.

Code:
Options -Indexes +SymLinksIfOwnerMatch
RewriteEngine on
RewriteBase /
# Include in the next line all folders to exclude

RewriteCond %{REQUEST_URI}  !(folder1|folder2) [NC]
RewriteCond %{REQUEST_URI} !^/joomla/

# Rewrites all URLS [Replace "domain" with the actual domain, without the TLD (.com, .net, .biz, etc)]
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.com

# Rewrite all those to insert /folder
RewriteRule ^(.*)$ /joomla/$1 [L]


Step 2

Set the livesite variable in joomla/configuration.php to mysite.com

Step 3

Add a file called index.php (which is what VirtualO suggested) to the root which includes this code:

Code:
<?php
include('joomla/index.php');
?>


Reading the different instructions given across the web, it looks like what will work with one host won't necessarily work with another, so I guess I should note that this is on a Hostgator server.


This works... Great stuff..

_________________
http://emanipur.org
Top Web designing team in Imphal,Manipur(India).


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 48 posts ]  Go to page Previous  1, 2



Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group