Hi I have a site

the directory of drupal is sitename.com/drupal5x/

How/what can I do to remove or mask 'drupal5x/' from the url? I got a shared hosting/reseller webhosting plan (no shell access for now.)

P.S

Drupal's the Best Free CMS Solution! (I've tried about 6 to 8 solutions.)

Comments

v8powerage’s picture

Thi is very easy to do. What You have to do is just move content of folder /drupal5x to main directory 'root' on your server and remove folder /drupal5x that's solve Your problem.

JirkaRybka’s picture

On our site, we had the same problem - Drupal is in a subdirectory called simply "drupal". Moving its contents to the root directory is not a solution for us because of the following reasons:

- It's not a new website, it's switching from plain HTML to CMS. Therefore, the root directory is already packed with tons of files and directories (with name-collisions if Drupal moved also), which needs to stay alive for some years (a kind of "archive" section for the community), until being totally outdated. May not be moved, as it's plain HTML files with lots of "hard-wired" links to each other.

- The Drupal site needed to run some time on the live server as beta-testing, to allow it adapting our users' needs, and then switching smoothly, already filled with some minimum contents. No wish to launch the "fantastic new version" of people's favorite website, without having any contents in it. As the whole thing is rather community-based, and they are far from being computer-experts, Drupal got pretty full of user-contributions with literal-URL links in text, which will be broken if moving the whole to another directory.

- A great solution would be URL-rewriting via .htaccess (allowing clean URLs too), but unfortunately on our shared webhosting we don't have the permission (it simply doesn't work for us).

So, finally we leaved Drupal where it was - the word "drupal" in our URL's is a kind of "powered by" notice, and it saves a lot of trouble to let things just work unchanged. We only just placed a .htaccess file to our root directory, containing this single line: RedirectMatch ^/$ http://domain.cz/drupal/ This sends all new visitors (who type just the domain into their browser) to our Drupal installation, while linking to the original HTML-website is still possible (even http://domain.cz/index.html works, allowing visitiors to navigate through the old web via its original front-page). There are hints that this might lower a site's ranks in search-engines such as Google, but our site seems to show up on Google reasonably well (you're never certain about this, though).

SteveBayerIN’s picture

Thank you very much JirkaRybka

Thats a much more efficient line of code than the one I've been using.

Well SEO does get hampered a bit (not that I need SEO right now) because the google crawler seems to treat http://www.sitename.com and http://sitename.com as 2 individual sites and therefore penalizes both for having duplicated content.

There is a work around where www.sitename.com is masked and only http://sitename.com is seen by the search engine crawler.

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{http_host} ^sitename.com [NC]
RewriteRule ^(.*)$ http://www.sitename.com/drupal$1 [R=301,L]

Those lines of .htaccess code are probably incomplete and they might not be compatible with the 'RedirectMatch ^/$ http://sitename.com/drupal/' line of code or be useful when content exists on Pre-Drupal pages and Current Drupal pages on the same domain.

P.S

How do I gray out a line of code such as [RedirectMatch ^/$ http://sitename.com/drupal/] on Drupal forums?

JirkaRybka’s picture

Just a few notices:

- The "www" was omitted, because of a login-problem. If you come to Drupal site twice by typing the address with/without "www" into your browser, then log-in, you'll get two different cookies, one of which is invalid for after-login-redirected page, so you seem to be not logged in correctly. (Or at least, this was the case when we were beginning, I don't track this issue anymore. Also there was a lot in the Drupal forums about this.) So our redirect enforces url-consistency for new visitors (and their bookmarks too), effectively solving the problem.

- "RewriteEngine On" - I would love to use this one for quite a lot of purposes, but on our shared webhosting, ANY .htaccess containing this line results in a "500 internal server error", breaking the site completely. We're not allowed to use this magic, to say it simply. :-(

- Code highlighting (gray line) on this forum - see help below textfield. I used the code tag, i.e. like "< code >text< /code >" (see exact syntax below your edits, it's rather difficult to show the tags here without executing them).