Advertisement
Install Joomla in root or in subdirectory?
Moderator: General Support Moderators
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.
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.
-
- Joomla! Apprentice
- Posts: 25
- Joined: Fri Feb 15, 2008 11:59 am
Install Joomla in root or in subdirectory?
Hi
I usually install Joomla into the root directory of my hosted site but was wondering if it could be neater for me to install into a subdirectory like mydomain.com/cms?
I would then have to redirect any traffic from mydomain.com to mydomain.com/cms.
Does this make more sense or should I just install it straight into my root?
What do you do?
Thanks!
I usually install Joomla into the root directory of my hosted site but was wondering if it could be neater for me to install into a subdirectory like mydomain.com/cms?
I would then have to redirect any traffic from mydomain.com to mydomain.com/cms.
Does this make more sense or should I just install it straight into my root?
What do you do?
Thanks!
Advertisement
-
- Joomla! Virtuoso
- Posts: 3173
- Joined: Sun Apr 16, 2006 12:20 am
- Location: 127.0.0.1
Re: Install Joomla in root or in subdirectory?
It does not matter.
If you want your directories neat, then a subdirectory would be better.
Personally, I prefer installing at the root so the url to the site would be domain.com instead of something like domain.com/cms
If you want your directories neat, then a subdirectory would be better.
Personally, I prefer installing at the root so the url to the site would be domain.com instead of something like domain.com/cms
Backup, backup, backup!
The "Master" .htacess file by Nicholas http://snipt.net/nikosdion/the-master-htaccess
The "Master" .htacess file by Nicholas http://snipt.net/nikosdion/the-master-htaccess
-
- Joomla! Fledgling
- Posts: 3
- Joined: Mon Mar 10, 2008 4:27 pm
Re: Install Joomla in root or in subdirectory?
If installed in the subdirectory, how can we hide the subdirectory in the urligeoffi wrote:It does not matter.
If you want your directories neat, then a subdirectory would be better.
Personally, I prefer installing at the root so the url to the site would be domain.com instead of something like domain.com/cms
![Huh ???](./images/smilies/icon_question.gif)
-
- Joomla! Apprentice
- Posts: 7
- Joined: Mon Jun 25, 2007 1:40 pm
Re: Install Joomla in root or in subdirectory?
You can redirect your dns specifically to subdirectory you installed joomla into.
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory?
It is best for SEO purposes to use the redirect command in the in the .htaccess file. There is 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.
If you are using SEF URLs then make sure you make the following change in your .htaccess file also, or they won't work.
The command is:
Redirect /index.html http://www.yourdomain.ext/htdocs
assuming you put your Joomla files in subdirectory htdocs.
If you are using SEF URLs then make sure you make the following change in your .htaccess file also, or they won't work.
Hopefully this information will save you the numerous hours and the frustration it took me to figure this stuff out on my own. This information should be put in an installation area.iamplatinum wrote:I have resolved the SEF URLs by changing the standard line of code in the .htaccess file
# 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/
Now it is obvious what the comment above the line of code was trying to say.
-
- Joomla! Fledgling
- Posts: 4
- Joined: Tue May 27, 2008 7:59 pm
Re: Install Joomla in root or in subdirectory?
Okay, I finally found the solution to the problem:
http://www.drichproductions.com/random- ... ectory.php
Good Luck!
http://www.drichproductions.com/random- ... ectory.php
Good Luck!
Run an iPhone Business - http://www.redrome.com
-
- Joomla! Fledgling
- Posts: 2
- Joined: Mon Sep 24, 2007 9:08 pm
Re: Install Joomla in root or in subdirectory?
If you put Joomla in a subdirectory with an .htaccess redirect, will there be problems for the users in accessing files from other subdirectories off the root (like photo galleries etc)?
thanks
David
thanks
David
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory?
I have other subdirectories in the root that contain PDF files and downloadable files that are referrenced in various Joomla menus, modules, and articles. There are no problems accessing them.
-
- Joomla! Apprentice
- Posts: 10
- Joined: Wed Sep 20, 2006 4:21 pm
Re: Install Joomla in root or in subdirectory?
Used the method at the link posted by DipDog3 and it works, but now have another problem.
Can't access any other folders in root. Get redirected to the Joomla site instead.
Anybody able to confirm this is a problem and/or provide a fix?
Thanks
Can't access any other folders in root. Get redirected to the Joomla site instead.
Anybody able to confirm this is a problem and/or provide a fix?
Thanks
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory?
I haven't tried the code presented in DRich Productions (your indirect reference via DipDog3). Have you tried removing the additional rewrite code they suggest and see if that works? The code they suggest could inhibit access to other subdirectories. Comment out the additional code and give it a quick try.
-
- Joomla! Apprentice
- Posts: 10
- Joined: Wed Sep 20, 2006 4:21 pm
Re: Install Joomla in root or in subdirectory?
Thanks for responding. I should have added that I want to hide the Joomla folder in the url.
I find if I specify the folders not to be affected it works. !^(folder1|folder2|folder3)
Was hoping not to have to edit .htaccess every time I create a new folder though![Smiley :)](./images/smilies/icon_smile.gif)
Maybe there is still a better way...
This is what I'm using now:
I find if I specify the folders not to be affected it works. !^(folder1|folder2|folder3)
Was hoping not to have to edit .htaccess every time I create a new folder though
![Smiley :)](./images/smilies/icon_smile.gif)
Maybe there is still a better way...
This is what I'm using now:
Code: Select all
RewriteRule ^$ /joomla/ [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule !^(folder1|folder2|folder3)(/.*)?$ /joomla%{REQUEST_URI} [QSA,L]
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory?
I understood why you want to use that code, however, I recognized the code was limiting your access, and I was suggesting that you comment out the code to test.
Now you found a solution. That's great and thanks for posting it.
Now you found a solution. That's great and thanks for posting it.
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory-SOLVED?
I would like to provide a more complete overview and solution to this topic. I know little about the Apache Web Server .htaccess commands. Like many other Joomla enthusiasts I use the .htacess code by recommendation and trail and error.
Recognize that installing Joomla in a subdirectory is advantageous from a file management persepctive for certain users. I have several (minor) websites, document directories, and other functions as subdirectories of my root directory. It would be quite a mess if all of these were in the root, and not organized into subdirectories.
The redirect command can be used in the .htaccess file so that your yoursite.com/subdir can be accessed directly with redirect command in the .htacess file.
Definitions
www.yoursite.com -- your website domain name
subdir - the subdirectory in which Joomla is installed
A drawback of Joomla in a subdirectory is that the website shows as:
http://www.yoursite.com/subdir
A couple of the previous posts addressed ways to circumvent this limitation. Instead of the redirect command, DipDog3 and YoungMonkey built on an alternative approach.
I have this alternative functioning on three websites, one of which is fairly complex all based on Joomla 1.5.9. The websites use SEF URLS, Mod Rewrite, and they have Community Builder (CB) installed. I mention these options and extensions because there were problems with them. Also I should mention that our websites are all on GoDaddy Shared Hosting Accounts.
The .htaccess code I used was a hybrid between the code suggested by DipDog3, YoungMonkey, and other code I have found posted on this forum.
Here is the code with comments annotations and revisions. In total you are adding eight NEW lines of code as shown below. My comments are preceded with ##. Original are preceded by #.
This code seems to work except for the following problem I encountered, which I hope someone may be able to explain.
With the SEF URLs AND Mod_Rewrite ON in the Joomla Globals, I could not get the CB Login to go to the destination page. I received an error saying cookies were not enabled even though they are enabled in the browser (by the way I only tested this with IE7 -- I always suggest testing with FireFox too as I have suggested in these forums. (Do as I say, not as I do)).
However everythings works with SEF URLs ON and Mod_Rewrite OFF in the Joomla Globals.
Since the .htaccess code above includes
RewriteEngine On
does make any difference?
Also, does anyone know if there are advantages from a SEO perspective to the above approach giving
http://www.yoursite.com
instead of
http://www.yoursite.com/subdir?
If anyone finds typos in the above code or my comments in the code, please zing me an email/contract privately and I will correct them.
Recognize that installing Joomla in a subdirectory is advantageous from a file management persepctive for certain users. I have several (minor) websites, document directories, and other functions as subdirectories of my root directory. It would be quite a mess if all of these were in the root, and not organized into subdirectories.
The redirect command can be used in the .htaccess file so that your yoursite.com/subdir can be accessed directly with redirect command in the .htacess file.
Definitions
www.yoursite.com -- your website domain name
subdir - the subdirectory in which Joomla is installed
Code: Select all
##The following line is to redirect http://www.yoursite.com/index.htm
#to http://www.yoursite.com/subdir/index.htm
Redirect 301 /index.htm http://www.yoursite.com/subdir
.
.
# change RewriteBase / (root) to the subdir in which Joomla is installed.
RewriteBase /subdir
http://www.yoursite.com/subdir
A couple of the previous posts addressed ways to circumvent this limitation. Instead of the redirect command, DipDog3 and YoungMonkey built on an alternative approach.
I have this alternative functioning on three websites, one of which is fairly complex all based on Joomla 1.5.9. The websites use SEF URLS, Mod Rewrite, and they have Community Builder (CB) installed. I mention these options and extensions because there were problems with them. Also I should mention that our websites are all on GoDaddy Shared Hosting Accounts.
The .htaccess code I used was a hybrid between the code suggested by DipDog3, YoungMonkey, and other code I have found posted on this forum.
Here is the code with comments annotations and revisions. In total you are adding eight NEW lines of code as shown below. My comments are preceded with ##. Original are preceded by #.
Code: Select all
# The following line can be commented out if causes errors.
##I did not find this to matter so I left it uncommented
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
## The configuration in the three lines above and two lines of code that follow are from the DipDog3 reference.
## The following section must come next immediately after the Rewrite Base command!
###BEGINNING OF SECTION###
#This masks the Joomla Subdir name in the URL and allows access to other subdirectories in the root
# Add trailing slash if path does not contain a period or end with a slash
##(after $1 in second line - you may need to test the need for this by trial and error).
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.yoursite.com/$1/ [R=301,L]
##I don't remember who I copied the following from but use it and not the code from
##the previous source because it didn't rewrite for http://yoursite.com. Use the following.
#When somebody links to your website,
#sometimes they don't always link to you in the way that you want them to.
# If somebody links to www.yoursite.com and somebody else links to yoursite.com,
#Google will assign a separate pagerank for each of those. Yes, it is stupid but it is true,
#by inserting the below example into your .htaccess file,
#it will solve the problem by redirecting anything linking to yoursite.com to www.yoursite.com,
#also redirecting the pagerank.
#
rewritecond %{http_host} ^yoursite\.com [NC]
rewriteRule ^(.*) http://www.yoursite.com/$1 [R=301,L,NC]
## The following four lines of code are from YoungMonkey's reply,
##and they are substitute code for the last two lines of code referred by DipDog3.
##Rewrites http://www.yoursite.com/subdir to http://www.yoursite.com/
##and it allows selected subdirectories to be also be accessed.
##For example, if you have document downloads in a subdir2 that are to be accessed directly
##or through a call from your Joomla code,
##you need to specify them in the second RewriteRule that follows.
##I suggest that at minimum you specify your Joomla subsirectory [i]subdir[i].
##Also do not terminate the list with |.
RewriteRule ^$ /subdir/ [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule !^(subdir|subdir1|subdir2|...|...|subdirN)(/.*)?$ /subdir%{REQUEST_URI} [QSA,L]
###END OF SECTION###
With the SEF URLs AND Mod_Rewrite ON in the Joomla Globals, I could not get the CB Login to go to the destination page. I received an error saying cookies were not enabled even though they are enabled in the browser (by the way I only tested this with IE7 -- I always suggest testing with FireFox too as I have suggested in these forums. (Do as I say, not as I do)).
However everythings works with SEF URLs ON and Mod_Rewrite OFF in the Joomla Globals.
Since the .htaccess code above includes
RewriteEngine On
does make any difference?
Also, does anyone know if there are advantages from a SEO perspective to the above approach giving
http://www.yoursite.com
instead of
http://www.yoursite.com/subdir?
If anyone finds typos in the above code or my comments in the code, please zing me an email/contract privately and I will correct them.
-
- Joomla! Guru
- Posts: 907
- Joined: Sun Dec 21, 2008 6:35 pm
- Location: USA
Re: Install Joomla in root or in subdirectory?
You can also just setup Apache to use this as your DocumentRoor in the httpd.conf file.
DocumentRoot /joomla
or
DocumentRoot /mysites/site1
If you are using virtual hosts (several sites on one server) you put this in the vhost.d directory in a file like 10-hosts.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.site1.com
DocumentRoot /mysites/site1
ErrorLog /var/logs/site1_error
CustomLog /var/logs/site1_access combined
</VirtualHost>
dpminusa
DocumentRoot /joomla
or
DocumentRoot /mysites/site1
If you are using virtual hosts (several sites on one server) you put this in the vhost.d directory in a file like 10-hosts.
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.site1.com
DocumentRoot /mysites/site1
ErrorLog /var/logs/site1_error
CustomLog /var/logs/site1_access combined
</VirtualHost>
dpminusa
- iamplatinum
- Joomla! Intern
- Posts: 72
- Joined: Tue Dec 25, 2007 6:32 pm
Re: Install Joomla in root or in subdirectory?
That's a good suggestion. We will try it in the future if we migrate to a more sophisticate level of hosting--right now we have a shared hosting service.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Sun Apr 26, 2009 6:11 pm
Re: Install Joomla in root or in subdirectory?
Thanks for putting in the time to explain everything iamp. I'm definitely closer to my end goal. The final code does hide my sub-directory initially, but once i click a link the sub-directory shows up in the URL again.
mysite.com > mysite.com/joomla/page1
Is there a setting in this I can change to mask that subdirectory completely?
thanks
mysite.com > mysite.com/joomla/page1
Is there a setting in this I can change to mask that subdirectory completely?
thanks
-
- Joomla! Guru
- Posts: 907
- Joined: Sun Dec 21, 2008 6:35 pm
- Location: USA
Re: Install Joomla in root or in subdirectory?
Any directory starting with a . (DOT) is invisible in *NIX.
For example, if you do "dir -a" on a directory you will see the hidden files and directories. With out this special command they are invisible.
dpminusa
For example, if you do "dir -a" on a directory you will see the hidden files and directories. With out this special command they are invisible.
dpminusa
-
- Joomla! Apprentice
- Posts: 21
- Joined: Sun Apr 26, 2009 6:11 pm
Re: Install Joomla in root or in subdirectory?
Here is the what I ended up with. Maybe I missed something.
The sagebrush.cc is my site and sageweb is my subdirectory.
I'll go through the code you sent and see what differences I can find.
thanks
The sagebrush.cc is my site and sageweb is my subdirectory.
Code: Select all
# The following line can be commented out if causes errors.
##I did not find this to matter so I left it uncommented
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
## The configuration in the three lines above and two lines of code that follow are from the DipDog3 reference.
## The following section must come next immediately after the Rewrite Base command!
###BEGINNING OF SECTION###
#This masks the Joomla Subdir name in the URL and allows access to other subdirectories in the root
# Add trailing slash if path does not contain a period or end with a slash
##(after $1 in second line - you may need to test the need for this by trial and error).
RewriteCond %{REQUEST_URI} !(\.|/$)
RewriteRule (.*) http://www.sagebrush.cc/$1/ [R=301,L]
##I don't remember who I copied the following from but use it and not the code from
##the previous source because it didn't rewrite for http://yoursite.com. Use the following.
#When somebody links to your website,
#sometimes they don't always link to you in the way that you want them to.
# If somebody links to www.yoursite.com and somebody else links to yoursite.com,
#Google will assign a separate pagerank for each of those. Yes, it is stupid but it is true,
#by inserting the below example into your .htaccess file,
#it will solve the problem by redirecting anything linking to yoursite.com to www.yoursite.com,
#also redirecting the pagerank.
#
rewritecond %{http_host} ^sagebrush\.cc [NC]
rewriteRule ^(.*) http://www.sagebrush.cc/$1 [R=301,L,NC]
## The following four lines of code are from YoungMonkey's reply,
##and they are substitute code for the last two lines of code referred by DipDog3.
##Rewrites http://www.yoursite.com/subdir to http://www.yoursite.com/
##and it allows selected subdirectories to be also be accessed.
##For example, if you have document downloads in a subdir2 that are to be accessed directly
##or through a call from your Joomla code,
##you need to specify them in the second RewriteRule that follows.
##I suggest that at minimum you specify your Joomla subsirectory [i]subdir[i].
##Also do not terminate the list with |.
RewriteRule ^$ /sageweb/ [QSA,L]
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule !^(media|sb_email|...|...|subdirN)(/.*)?$ /subdir%{REQUEST_URI} [QSA,L]
###END OF SECTION###
thanks
-
- Joomla! Apprentice
- Posts: 10
- Joined: Sat Apr 04, 2009 6:18 pm
Re: Install Joomla in root or in subdirectory?
Hello everyone,
Thank your for the great help. I was wondering if there is a way to redirect to a specific subdirectory depending on the URL and masking the subdirectory in the URL itself.
Thank you.
Thank your for the great help. I was wondering if there is a way to redirect to a specific subdirectory depending on the URL and masking the subdirectory in the URL itself.
Thank you.
-
- Joomla! Guru
- Posts: 907
- Joined: Sun Dec 21, 2008 6:35 pm
- Location: USA
Re: Install Joomla in root or in subdirectory?
This is a very interesting post. Lots to be learned.
If I understand the original question:
For example, (Assuming *NIX, Apache 2.x)
Your Apache configuration files are in /etc/apache2/. The main file is httpd.conf. Editing it you can turn on the reference to the supplemental configuration files, so they will be included in the configuration when Apache is loaded.
Remove the leading comment character (#) from this line to add the virtual host config files.
Now you have a bunch of directives you can add in the files, in this sub-directory (vhosts.d), to accomplish what you need with website sub-directories.
To make /var/www/localhost/htdocs/mysite/joomla be the root for http://www.mysite.com you can use the 00_default_vhost.conf file to create as many virtual host containers as you wish. They will be used to define the doc root for the sites. The ServerName entry is what the browser gets in its header conversations with your server, or search engines get.
It is also possible to add virtual host containers in httpd.conf directly. This is not preferred.
It seems to me that the discussion here may be trying to recreate this existing Apache capability external to the Apache configuration files with mod-rewrite. This is very interesting, but difficult, and it would seem, unnecessary.
mod-rewrite is a modified form of regular expressions. Regular expressions are a bit more complex part of any programming language or configuration tool. mod-rewrite should be turned on and used in Joomla. It is a prerequisite for SEF. It will do things Apache configuration files don't. It seems like the hard way for the topic of this post.
You may want to look at the Apache supplemental configuration system for a simpler, more powerful solution. The Apache.org website has the rest of the doc. The Configuration files have a lot of embedded doc already.
Hope this helps.
dpminusa
If I understand the original question:
I usually install Joomla into the root directory of my hosted site but was wondering if it could be neater for me to install into a sub-directory like mydomain.com/cms?
This is what I have always done. The DNS really defines a new Zone that allows resolution of the address and the Apache configuration links this to a site and its pages. The sub-directory is not part of the URL then. Apache uses the full path name to represent the domain. The URLs appear as if they were at a root position.@aquazie
You can redirect your dns specifically to subdirectory you installed joomla into.
For example, (Assuming *NIX, Apache 2.x)
Your Apache configuration files are in /etc/apache2/. The main file is httpd.conf. Editing it you can turn on the reference to the supplemental configuration files, so they will be included in the configuration when Apache is loaded.
Remove the leading comment character (#) from this line to add the virtual host config files.
Code: Select all
Include /etc/apache2/vhosts.d/*.conf
To make /var/www/localhost/htdocs/mysite/joomla be the root for http://www.mysite.com you can use the 00_default_vhost.conf file to create as many virtual host containers as you wish. They will be used to define the doc root for the sites. The ServerName entry is what the browser gets in its header conversations with your server, or search engines get.
Code: Select all
<VirtualHost *:80>
ServerAdmin [email protected]
ServerName www.mysite.com
DocumentRoot /u/apache/htdocs/mysite/joomla
ErrorLog /u/apache/logs/mysite_error
CustomLog /u/apache/logs/mysite_access combined
</VirtualHost>
It seems to me that the discussion here may be trying to recreate this existing Apache capability external to the Apache configuration files with mod-rewrite. This is very interesting, but difficult, and it would seem, unnecessary.
mod-rewrite is a modified form of regular expressions. Regular expressions are a bit more complex part of any programming language or configuration tool. mod-rewrite should be turned on and used in Joomla. It is a prerequisite for SEF. It will do things Apache configuration files don't. It seems like the hard way for the topic of this post.
You may want to look at the Apache supplemental configuration system for a simpler, more powerful solution. The Apache.org website has the rest of the doc. The Configuration files have a lot of embedded doc already.
Hope this helps.
dpminusa
-
- Joomla! Apprentice
- Posts: 10
- Joined: Sat Apr 04, 2009 6:18 pm
Re: Install Joomla in root or in subdirectory?
Hello,
What i wanted to do is have many URLs pointing to the same IP and redirect each request to the appropriate subfolder of public_html based on the requested URL. I hoped that could be accomplished through an appropriate .htaccess file. I know this can be done via httpd.conf but that is something i do not have control on a shared hosting plan.
Thank you for any suggestions.
What i wanted to do is have many URLs pointing to the same IP and redirect each request to the appropriate subfolder of public_html based on the requested URL. I hoped that could be accomplished through an appropriate .htaccess file. I know this can be done via httpd.conf but that is something i do not have control on a shared hosting plan.
Thank you for any suggestions.
-
- Joomla! Guru
- Posts: 907
- Joined: Sun Dec 21, 2008 6:35 pm
- Location: USA
Re: Install Joomla in root or in subdirectory?
I see.
Have the mod_rewrite commands that have been shared with you solved the problem, or do you need more help?
dpminusa
Have the mod_rewrite commands that have been shared with you solved the problem, or do you need more help?
dpminusa
-
- Joomla! Apprentice
- Posts: 10
- Joined: Sat Apr 04, 2009 6:18 pm
Re: Install Joomla in root or in subdirectory?
Well, my problem is not solved with the commands stated above since they do not address the same problem. The solution above redirects the request to a subdirectory masking the subdirectory in the URL. Could you point me to some mod_rewrite valid documentation?
If i manage to resolve the issue i would be glad to share it with you. Thanks again.
If i manage to resolve the issue i would be glad to share it with you. Thanks again.
Last edited by gosta19 on Mon May 04, 2009 8:41 pm, edited 1 time in total.
-
- Joomla! Guru
- Posts: 907
- Joined: Sun Dec 21, 2008 6:35 pm
- Location: USA
Re: Install Joomla in root or in subdirectory?
I meant the thread as a whole. In other words, do you have any solution to this. I am NOT asking for help. I am offering to get more involved if you are still stuck.
dpminusa
dpminusa
-
- Joomla! Apprentice
- Posts: 10
- Joined: Sat Apr 04, 2009 6:18 pm
Re: Install Joomla in root or in subdirectory?
I understand you are not asking for help. I will do my homework (study mod_rewrite) and hopefully come back with a full solution. If i am stuck, i will ask for help here. Thanks again.
-
- Joomla! Apprentice
- Posts: 21
- Joined: Sun Apr 26, 2009 6:11 pm
Re: Install Joomla in root or in subdirectory?
I applied the following code and it worked perfect in Firefox, but IExplorer gives me an error page. Any ideas how to change this to work with IE?
Thanks
http://domain.com/joomla/index.php
will become
http://domain.com/index.php
mod_rewrite removes the subfolder from the url.
1. edit the file joomla/configuration.php.
In Joomla 1.5 var live_site is empty by default
Change
var live_site = '';
To
var live_site = 'http://domain.com';
In Joomla 1.0 you would be looking in the same file for $mosConfig_live_site =
2. Edit or create the file named .htaccess (invisible files begin with a period) in
your webroot (not the one in the joomla subdirectory) and change its content to:
#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://domain.com/joomla/ [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} !^/joomla/
# 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 /joomla
RewriteRule ^(.*)$ /joomla/$1 [L]
Replace domain.com with your domain and joomla with the name of the
subdirectory in which you have installed Joomla.
Thanks
-
- Joomla! Fledgling
- Posts: 1
- Joined: Thu Jan 25, 2007 4:50 am
Re: Install Joomla in root or in subdirectory?
I am not sure if someone is viewing this thread actively. My problem is that I have a Windows-based server, so Apache-related changes are not applicable. I installed Joomla 1.5.9 in a subdir named "joomla". I added all the code mentioned above in the .htaccess file in the "root" directory of my website. However, after making the suggested changes to the "configuration.php" file, I get the following error page:
404 - Component not found
You may not be able to visit this page because of:
1. an out-of-date bookmark/favourite
2. a search engine that has an out-of-date listing for this site
3. a mistyped address
4. you have no access to this page
5. The requested resource was not found.
6. An error has occurred while processing your request.
Please try one of the following pages:
* Home Page
If difficulties persist, please contact the System Administrator of this site.
Component not found
Is this happening because I used a dummy "index.html" to redirect to the "joomla" subdir? Of course, if I leave the configuration.php file unchanged, nothing changes. The "joomla" directory shows up on all URLs. I have SEO enabled.
404 - Component not found
You may not be able to visit this page because of:
1. an out-of-date bookmark/favourite
2. a search engine that has an out-of-date listing for this site
3. a mistyped address
4. you have no access to this page
5. The requested resource was not found.
6. An error has occurred while processing your request.
Please try one of the following pages:
* Home Page
If difficulties persist, please contact the System Administrator of this site.
Component not found
Is this happening because I used a dummy "index.html" to redirect to the "joomla" subdir? Of course, if I leave the configuration.php file unchanged, nothing changes. The "joomla" directory shows up on all URLs. I have SEO enabled.
- dr_lionheart
- Joomla! Enthusiast
- Posts: 115
- Joined: Wed Aug 26, 2009 2:19 am
- Location: Jeddah-Saudi Arabia
- Contact:
Re: Install Joomla in root or in subdirectory?
it depends on what you want
in the future,will you install another script in your site or just the joomla one?
if yes, which one is the main script so it will be in the root directory?
in the future,will you install another script in your site or just the joomla one?
if yes, which one is the main script so it will be in the root directory?
PHP designer,
manager,RISEMYWEB
http://www.voxelx.com | Online DICOM viewer and library for radiologists
manager,RISEMYWEB
http://www.voxelx.com | Online DICOM viewer and library for radiologists
-
- Joomla! Apprentice
- Posts: 10
- Joined: Sun Jun 10, 2007 5:31 pm
Re: Install Joomla in root or in subdirectory?
Your solution worked perfectly for me dpminsua - many thanks - Ben
- geoffmack
- Joomla! Intern
- Posts: 93
- Joined: Tue Oct 20, 2009 8:06 pm
- Location: San Francisco, CA
- Contact:
Re: Install Joomla in root or in subdirectory?
I wish I understood this better. I have been unable to get this htaccess file to work. When I visit my domain I get the root index.html page instead of my Joomla installation which is in the joomla15 subdir. I did manage to get another htaccess file to work, however it caused my administrator panel to start returning 404s. I am at a complete loss.
I guess I'm going to have to diff this file with the one that worked and see if I can some up with some hybrid file, but I'm WAY over my head.
Here's the section from the htaccess file that actually worked (but screwed up my admin panel)
########## Begin - Rewrite rules to move site from subdir to root
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/joomla15/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /joomla15/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ joomla15/index.htm [L]
I guess I'm going to have to diff this file with the one that worked and see if I can some up with some hybrid file, but I'm WAY over my head.
Here's the section from the htaccess file that actually worked (but screwed up my admin panel)
########## Begin - Rewrite rules to move site from subdir to root
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteCond %{REQUEST_URI} !^/joomla15/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /joomla15/$1
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com$
RewriteRule ^(/)?$ joomla15/index.htm [L]
Advertisement