Forum Moderators: phranque
I thought this would work, however after finding this forum and reading around I'm not so sure.We have been working on an upgrade to out website and the new one was put into a folder for testing. it is now at domain dot org/folder.
I really have no desire to move it all down so I thought I could just change the DNS entry so that domain dot org pointed to domain dot org/folder.
I want to do this so that recent links sent out to promotional materials will still work and to save the trouble of moving everything.
If I cannot do this through DNS what is my best option? I would say that I have a low level of experience configuring Apache, I have set up a server or 2 but not done much with them after they are working.
Any suggestion would be very much appreciated.
All I really need to do is point domain dot org to domain dot org/folder or, if nessasary, domain dot org/folder/homepage
I do not need to redirect everthing with domain dot org to the new folder.
I am activly reading through the forums loking for the best way to do this.
thanks.
This strikes me as a short-sighted and possibly-damaging approach.
I recommend that you externally redirect the promotional URLs from the sub-folder to the top-level directory, and then, if you really cannot move the files to that top-level directory, internally rewrite request for those pages, when requested from the top-level directory, to the correct file location in the subfolder.
Do not change your home page URL -- You will suffer, either short-term or long-term, in search engine rankings. Further, using an external redirect to correct the published promotional URLs will help to 'recover' any linking benefit you might lose if people link to those promotional URLs.
Implicit in this recommendation is that fact that a URL is not a filepath, and URLs therefore do not dictate where page content is stored. A URL is a location on the Web, while a filepath is a location in a server filesystem; The two need not be related.
Also, an external redirect and an internal rewrite are different things; An external redirect involves the client (browser) and the URL change is visible to the user, whereas an internal rewrite changes only the filepath associated with a URL, and is not visible to the user.
An example of a code solution to this problem using mod_rewrite in .htaccess looks like this:
# Redirect incorrectly-published external links to actual URL
RewriteCond %{THE_REQUEST} ^[A-Z] /subfolder/homepagename
RewriteRule ^subfolder/homepagename http://example.com/ [R=301,L]
#
# Internally rewrite homepage URL to real file location
RewriteRule ^$ /folder/homepagename [L]
Jim