Jump to content

Recommended Posts

Hi everyone,

 

I tried to play with .htaccess of using http://localhost/friends to turn to a subdomain of http://friends.localhost

 

Now, I have remove the RewriteRule but the http://friends.localhost is still there whenever I tried to point to http://localhost/friends

 

Can anyone tell me how to remove the subdomain?

Link to comment
https://forums.phpfreaks.com/topic/89337-solved-subdomain-and-now-error/
Share on other sites

Please note: http://httpd.apache.org/docs/2.0/howto/htaccess.html#when

 

In general, you should never use .htaccess files unless you don't have access to the main server configuration file. There is, for example, a prevailing misconception that user authentication should always be done in .htaccess files. This is simply not the case. You can put user authentication configurations in the main server configuration, and this is, in fact, the preferred way to do things.

 

Using .htacess when you have access to the main server config can lead to messy configuration and lots of pitfalls for the new user.

 

Just to outline the way subdomains work...

The subdomain is a feature of DNS combined with the way you have configured your server environment. If your DNS name supports wildcard prefixes you have unlimited aliases to your website. However your server needs to be configured to respond to them properly.

This also applies to test-rigs such as your local machine (localhost) where you would normally insert DNS-type aliases into your local hosts file.

 

The way to do this would be using ServerAlias/ServerName in the main server httpd config file

http://httpd.apache.org/docs/2.0/mod/core.html#serveralias

http://httpd.apache.org/docs/2.0/mod/core.html#virtualhost

To disable this feature on a live server you need to configure your master server environment config since this is where these directives are in "context" (belong)

 

The main part of the problem - you have set up some form of redirection either by way of rules in your .htaccess files somewhere or may perhaps have created an INDEX.PHP redirect file. You would need to change whichever of these apply.

 

Without all of the code you have installed it would be difficult to comment further

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.