Domain to Domain

Discussion in 'Systems Administration' started by nflug, Aug 15, 2015.

  1. Hey Guys,

    I want to set my Domain like:

    www.mydomain.com/examplefolder/ to examplefolder.mydomain.com

    But it dont works :/
    I have a Linux VServer and rights to edit .httpaccess
    My host has only that options:
    [​IMG]
     
  2. You have to make an A record if you want a subdomain to point to an IP Example:

    My hosting company has 2 servers, I was to access ssh on them without having to use IP address. To access them better I made 2 "A" Records
    One being S1 and the second being S2. I pointed S1 to 192.xxx.x.xxx I pointed S2 to 192.yyy.y.yyy. Now when I want to acess the "X" IP address all I have to enter is s1.mydomain. For the above, you will have to do a redirect. Like in Cpanel:
    [​IMG]
     
  3. But for a folder to point to a subdomain, as far as I know it has to be a redirect which I am not sure which record it would be
     
  4. Its http and https but I dont have this option
     
  5. I dont have CPanel
     
  6. What Registrar do you have?
     
  7. Also what web hosting do you use?
     
  8. My Domain is hosted on a German Hoster, it have a Own Control Panel, and I have only this Features to add things:

    [​IMG]
    But I have installed Ajenti and Webmin on my Server
     
  9. Do you have access to your .htaccess file?
     
  10. Yes I have look at my First Post
     
  11. Alright, can you give me the full details of what sub directory you want to forward to the sub-domain?
     
  12. I have tryed it like that:
    Code (Text):

    RewriteCond %{HTTPS} on
    RewriteCond %{HTTP_HOST} ^http://example.mydomain.com
    RewriteRule ^(.*)$ http://mydomain.com/example/ [R=301,L]
     
    I want to forward example.mydomain.com to mydomain.com/example/
     
  13. Can you give me the actual details with your domain and the folder and subdomain? I will try to write you a quick .htaccess file that you can check
     
  14. You dont need my Domain to do that, I have write it with a custom Domain
     
  15. Ok, Ive tested one on my test domain and it should work.try this, but you have to replace with your domain and stuffs:

    This one redirect requests from www.example.com/blog to blog.example.com

    Code (Text):
    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
    RewriteRule ^blog/(.*)$ http://blog.example.com/$1 [L,QSA,R=301]

    RewriteCond %{HTTP_HOST} ^blog\.example\.com$
    RewriteCond %{REQUEST_URI} !^blog/
    RewriteRule ^(.*)$ /blog/$1 [L,QSA]
     
  16. My Question is now what is what?

    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
    RewriteRule ^blog/(.*)$ http://blog.example.com/$1 [L,QSA,R=301]

    RewriteCond %{HTTP_HOST} ^blog\.example\.com$
    RewriteCond %{REQUEST_URI} !^blog/
    RewriteRule ^(.*)$ /blog/$1 [L,QSA]

    Is the red one for 'blog.example.com' or for 'example.com/blog/
     
  17. Shouldnt really matter if the sub folder and sub domain are the same
     
  18. Dont work for me.

    Thats mine:

    Code (Text):

    RewriteCond %{HTTP_HOST} ^(www\.)?example\.de$
    RewriteRule ^banswebinterface/(.*)$ http://bans.example.de/$1 [L,QSA,R=301]

    RewriteCond %{HTTP_HOST} ^bans\.example\.de$
    RewriteCond %{REQUEST_URI} !^banswebinterface/
    RewriteRule ^(.*)$ /banswebinterface/$1 [L,QSA]
     
     
  19. Try:



    Code (Text):
    RewriteEngine on

    RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
    RewriteRule ^bans/(.*)$ http://bans.example.com/$1 [L,QSA,R=301]

    RewriteCond %{HTTP_HOST} ^banswebinterface\.example\.com$
    RewriteCond %{REQUEST_URI} !^banswebinterface/
    RewriteRule ^(.*)$ /blog/$1 [L,QSA]
     
  20. Still nothing, how long does it take? (I have restarted my Apache2 Server)