Solved

How do I hide the subdirectory name in the address bar?

Posted on 2006-06-21
8
843 Views
Last Modified: 2008-01-09
This is what I mean:

I have my site installed in the directory IHEA_47, one level below the root of http://ihea.info

So the path to the index page is http://ihea.info/ihea_47/home  (home is just a alias for the homepage).

In my Site5 hosting control panel i put in a redirection so http://ihea.info points to http://ihea.info/ihea_47 

What I want is that when the user arrives at http://ihea.info/ihea_47/home , he or she sees http://ihea.info/home and not the directory name the site installed. All navigation should be as if the site is in root folder.

How do I do that? I thought REDIRECTION would do that, but I keep seeing http://ihea.info/ihea_47 and all my absolute links inside my pages are broken now.

(I wrote the host a few hours ago and no response). They use the Cpanel. PHP running on Apache.
0
Comment
Question by:polaatx
  • 4
  • 2
8 Comments
 
LVL 15

Expert Comment

by:periwinkle
ID: 16959076
Try using an Alias instead:

Alias /home /full/path/to/ihea_47_home

withint hte VirtualHost container for ihea.info.
0
 
LVL 15

Expert Comment

by:periwinkle
ID: 16959088
Or... why not just change the ServerRoot in the httpd.conf file to be /full/path/to/idea_47 ?
0
 

Author Comment

by:polaatx
ID: 16959349
Hello, could you tell me howto do this? where would I find the VirtualHost container ?

Your second idea: I don't think I have access to httpd.conf. I've asked the host by email but they won't answer me. But went through every directory in the root and found nothing.
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 15

Expert Comment

by:periwinkle
ID: 16960194
Unless you have access to restarting the apache web server, you don't have access to the httpd.conf.

Unfortunately, if you don't have access to that, I don't believe that you'll be able to add an Alias to the .htaccess file... but it's worth a try.

You need to create a file called .htaccess and with that line, and stick it in the root of your site.  Be prepared to delete it, though, if it doesn't work, it will render your site unaccessable.  
0
 

Author Comment

by:polaatx
ID: 17022248
Hello, below is my current .htaccess residing in the root.

Could you kindly please tell me the exact code I should put in and where I should put it in.

Do I put in:

Alias /home /full/path/to/ihea_47_home

Is the above exact code or "path" is spaceholder for my particular path?

Here's my htaccess:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|install|module|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root)$">
  Order deny,allow
  Deny from all
</FilesMatch>

# Set some options.
Options -Indexes
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Reduce the time dynamically generated pages are cache-able.
<IfModule mod_expires.c>
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the prefix www.
  # you can use one of the following settings to force user to use only one option:
  #
  # If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
  # RewriteRule .* http://www.example.com/ [L,R=301]
  #
  # If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
  # RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
  # RewriteRule .* http://example.com/ [L,R=301]


  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.73 2006/04/14 09:08:26 killes Exp $
0
 
LVL 15

Accepted Solution

by:
periwinkle earned 500 total points
ID: 17023550
RE: Alias /home /full/path/to/ihea_47_home
RE: Is the above exact code or "path" is spaceholder for my particular path?


/full/path/to  is a placeholder for your actual path;  for example, if on your server, ihea_47_home is in the /home/ihea/www/ihea_47_home directory, then you would use:

Alias /home /home/ihea/www/ihea_47_home
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If your site has a few sections that need to be secure when data is transmitted between the server and local computer, such as a /order/ section for ordering or /customer/ which contains customer data, etc it would of course be recommended to secure…
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now