By techywoman on
Hi !
After reading and reading and re-reading info re clean urls, I am coming to the conclusion that one should not enable clean urls on a development site but, instead, wait to enable clean urls on the live, production site. I am having that thought because of the comments about relative and absolute path problems when uploading the dev site to the hosting space.
So, can someone tell me what they think about this thought of mine -- good, bad, no matter?
Comments
It is not so simple. There
It is not so simple. There are cases again...
URLs without a subdirectory path:
--------------------------------
Development site: http://devel.com/?q=node/15
img src="files/images/image.jpg works
img src="/files/images/image.jpg works
Moving to site: http://final.com/node/15 (clean URLs)
img src="/files/images/image.jpg works (only this one works -- no problem)
URLs with a subdirectory path:
-----------------------------
Development site: http://devel.com/drupaldir/?q=node/15
img src="files/images/image.jpg works
img src="/files/images/image.jpg doesn't work
img src="/drupaldir/files/images/image.jpg works
Moving to site: http://final.com/drupaldir/node/15 (clean URLs)
img src="/drupaldir/files/images/image.jpg works (only this one works)
This last one can be a problem. You can move the site to clean URLs only if you use the same subdirectory name. As it is, you can't move it to a different subdirectory name one to a domain's root.
I think the only rule of thumb for a smooth transfer to a final site which uses clean URLs is:
- At all times, avoid using for your sites an URL with a subdirectory path.
- If you intend to use an URL with a subdirectory path in the final site, then use the same directory name in the development site.
This rule doesn't change, no matter whether you use clean URLs in the development site or not. And of course, we are talking only about file links in the content. Other paths which are processed by Drupal, such as menu paths, are always relative.
Subdir...
Hi CogRusty --
1. My dev site followed set-up instructions to the tee (from packet drupal ebook) so the result is that the url on my PC is: http://localhost/drupal (Setup is: C:\apache2triad\htdocs\drupal )
As I have never developed a site on a local server, I ask this question: localhost is the domain..yes? and drupal is, obviously, the directory.
Right? (If so, pooh! The Drupal ebook should mention this early on!! Fair warning to others!)
-------------
2. To set up dev site on local computer using your instructions to create a url without a subdir path, am I correct in thinking that I should have added a new domain to my local hosts file and then pointed my drupal install to the new domain. Right? (this means not using the sites file in drupal but instead I should have used the setup: C:\apache2triad\htdocs\realname.orgname.edu where C:\apache2triad\htdocs\drupal points to it...)
---------------
3. The domain on the production server will be http://realname. orgname.edu
Am I correct in understanding that I should add to my local hosts file: realname.orgname.edu --> the entire tld rather than just realname
I can make these changes now if it will make life easier. Kinda confusing (she says, scratching her head..)
THANK YOU!!!!!!
1. Yes, that is correct. In
1. Yes, that is correct. In Drupal terms,
- http://localhost/drupal is called "the base URL" of the site
-
localhostis the domain name-
/drupalis an URL path, called "the base path" or "base URL path" of the site.The directory C:\apache2triad\htdocs\drupal is a filesystem path which corresponds to the above URL path. It is not necessary that they both end in
drupal. It could be mapped to any URL path.2. You can create "virtual hosts" in Apache. A virtual host basically has
- a domain name
- a corresponding "web document root" directory for its files
Examples:
ServerName myschool.edu
ServerAlias www.myschool.edu
DocumentRoot C:/apache2triad/htdocs/school (this dir name can be whatever you want).
ServerName physics.school.edu
DocumentRoot C:/apache2triad/htdocs/school/physicsdept
ServerName localhost
DocumentRoot C:/apache2triad/htdocs
ServerName drupaldev.localhost
DocumentRoot C:/apache2triad/htdocs/drupal
With some additional settings, all the above can work. There is documentation for virtual hosts. I made a point of using different names for the filesystem paths to show that they don't need to be the same as the URL paths, but you may want to keep them same or similar for tidiness.
The last one is what I suggested for a Drupal development site http://drupaldev.localhost. Drupal can be installed there in the usual way. Then it will be easy to take the database of this local site and load it to the database of a live site on the web, which also doesn't use a subdir path in its base URL.
3. I think this has been covered. You can map any domain name to any disk directory name, but following some conventions for keeping things tidy are always good.
All the above should not be confused with the exact names needed by Drupal under its "sites/" directory when you are setting up a Drupal multisite. A Drupal multisite needs your exact site URLs under "sites/", for its own internal use, to tell apart the different Drupal sites.
The only point relevant to the "movability" discussion is that if you set up a Drupal multisite, which has each site's settings under a directory with such a full name, don't put the files/images directories under those names because they are bound to change if you move.