PDA

View Full Version : Which came first, the domain or the directory?



ProAux
09-20-2007, 03:38 PM
I have my entire site in a directory, for example; /var/www/html/my_site_files/. However, the domain points to the root director, /var/www/html/ and then my .htaccess redirects all traffic to the /my_site_files/ directory. This is all because when I registered my domain, (before the install,) I had no idea what the install directory would be called.

Is this standard practice or can I/should I change my domain to point to the correct directory?

I really wish that stupid directory name was not shown in my address bar on every page.

ProAux

rolling
09-21-2007, 06:35 AM
I really wish that stupid directory name was not shown in my address bar on every page.

You can do this by using a rewrite rule in either an .htaccess file or your httpd.conf file. This article on URL Rewriting (http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html) looks like a promising guide.

wildjokerdesign
09-21-2007, 06:42 AM
Why not simply move your site files to /var/www/html? Depending on how big your site is it may be a bit of a pain to do but it would solve the problem and keep things within the default setup of an account on West Host.

ProAux
09-26-2007, 04:54 AM
Why not simply move your site files to /var/www/html? Depending on how big your site is it may be a bit of a pain to do but it would solve the problem and keep things within the default setup of an account on West Host.
I may want to add another site in another directory so, I really don't want to move it.

Judging from your replies I take it this means there is no way to change where my domain points to. Wouldn't that be the best fix?

wildjokerdesign
09-26-2007, 07:11 AM
Even if you moved it you could still add another domain at a later date. When you add new domains they can point wherever you want them to. They do not have to be located above /var/www/html.

Yes you can point your main domain any directory that you wish by editing your httpd.conf file. The problem with changing that is you lose access to such things as your Site Manager or any programs that are installed via your Site Manager. This could be overcome but by changing the default set up you make it harder for the support team at West Host to trouble shoot things for you. It is also possible that anything you install manually for your site might have problems.

Have a look at /ect/httpd/httpd.conf. It is well documented not only in the file but on the internet.

#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/www/html"

#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

That is just the tip of the iceberg of things you might have to change. :) If you changed those to point to your site files then you would lose the ability to access your Site Manager. You would have to create aliases to point to it and any other program installed via the Site Manager. Have a look at the content below:

# Alias_section_start - ServerDirector comment - do not delete
By default on an account I think there are at least four aliases you would want to set up. manager, fm, users and plugins.

Note You can take down your entire site if you make a mistake in editing your httpd.conf file. You also have to restart apache for the new configuration to take effect. This can be done by with the command restart in an SSH session or via your Site Manager. You may want to look closer at the link rolling supplied since useing Mod-Rewrite might be less work.

ProAux
09-27-2007, 05:27 PM
Even if you moved it you could still add another domain at a later date. When you add new domains they can point wherever you want them to. They do not have to be located above /var/www/html.

Yes you can point your main domain any directory that you wish by editing your httpd.conf file. The problem with changing that is you lose access to such things as your Site Manager or any programs that are installed via your Site Manager. This could be overcome but by changing the default set up you make it harder for the support team at West Host to trouble shoot things for you. It is also possible that anything you install manually for your site might have problems.

Have a look at /ect/httpd/httpd.conf. It is well documented not only in the file but on the internet.



That is just the tip of the iceberg of things you might have to change. :) If you changed those to point to your site files then you would lose the ability to access your Site Manager. You would have to create aliases to point to it and any other program installed via the Site Manager. Have a look at the content below:

By default on an account I think there are at least four aliases you would want to set up. manager, fm, users and plugins.

Note You can take down your entire site if you make a mistake in editing your httpd.conf file. You also have to restart apache for the new configuration to take effect. This can be done by with the command restart in an SSH session or via your Site Manager. You may want to look closer at the link rolling supplied since useing Mod-Rewrite might be less work.

This looks like a lot of work. I don't think I want to go there.

Also, I browsed through the mod_rewrite page and can't see any way to remove a directory name from the address. Another help site did mention it but all they did was confuse me.

Mine is a huge site but, now I am considering moving it all to the root directory just for peace of mind. Although, that may take some effort with all the internal links and directory dependent mods I've made. Yikes! Now I am pondering if it is really worth it.

Do you mean that is where I should have installed it to begin with?

Perhaps this is a case of, "We learn from our mistakes."

Thanks for the help guys,
ProAux

corvus
09-28-2007, 12:42 PM
ProAux,

Is this a custom built application, an installed application from site manager, or an application that you downloaded and installed?

If there are hard coded references through out the code, that can be adjusted using tools like grep and sed. However that requires using ssh which you may or may not be comfortable doing. (just to be clear, I'm not advising you to try this route first or really at all.)

If this is an application that you downloaded and installed, many times the fix is updating one or two files and the database entry for the site url.

Without knowing what specific application though, it's hard to offer anything more then general advice.

Scott

wildjokerdesign
09-28-2007, 06:45 PM
Do you mean that is where I should have installed it to begin with?

Yep your main site files should have been uploaded to /var/www/html. :) Sorry. Although it may be some trouble now I think you well save yourself some troubles down the line if you go ahead and move it now.

ProAux
09-28-2007, 10:18 PM
ProAux,

Is this a custom built application, an installed application from site manager, or an application that you downloaded and installed?

If there are hard coded references through out the code, that can be adjusted using tools like grep and sed. However that requires using ssh which you may or may not be comfortable doing. (just to be clear, I'm not advising you to try this route first or really at all.)

If this is an application that you downloaded and installed, many times the fix is updating one or two files and the database entry for the site url.

Without knowing what specific application though, it's hard to offer anything more then general advice.

Scott
It was a pre-packaged application. It does indeed have the site URL in the database so getting it up and running won't be much trouble.

Itís just that I added lots of my own help pages and unique mods. In doing so I sprinkled hard coded links, image source paths, and javascript all through the site. (Itís a bad habit, I know.) I will have to edit them manually.

It wouldnít be the end of the world. It would just mean a few hours work that I wasnít looking forward to. :rolleyes:

ProAux

ProAux
11-25-2007, 09:03 AM
UPDATE:

Well, I took the plunge and moved the site to the root as suggested. I spent a day fixing up the links and I think I have it all under control.

I put an .htaccess file in the old folder to redirect any odd backlinks that may have a directory specific path. So far, no complaints. It seems to work. In fact, now everything works the way I wanted it to.

Thanks for the advice and help. I do appreciate it.

(Another satisfied client.)