gncanhoto
By:
gncanhoto

how to transform every request for example.com to example.com/mysite/

June 30, 2016 543 views
LAMP Stack PHP

i'm running a LAMP stack (php5.6 and Apache/2.4.18) on top of ubuntu 16.04.

I need that every time my domain is called it shows also the folder were the site is stored. Something like: example.com/ should show example.com/mysite/

can any one help me please.
Thanks in advance

3 comments
  • Can you just change the DocumentRoot directive in your apache mysite virtual host configuration, or do you need to rewrite the URL because of your processing code?

  • hello gndo, thanks for the quick replay.

    i'm using newscoop and i'm migrating the platform, the problem is that i don't want to loose the old links to the site so the address as to be the same.

    I already have this virtual const conf in place.

    <VirtualHost *:80>
    DocumentRoot /var/www/html/myfolder/mysite
    ServerName example.com
    <Directory "/var/www/html/myfolder/mysite">
    AllowOverride All
    Require all granted
    Options -Indexes
    </Directory>
    </VirtualHost>

    I already tried to point to the DocumentRoot to /var/www/html/myfolder

    But i need that the site address example.com/mysite/ appears every time example.com is called.

    any suggestions?

  • ok based on the gndo sugestion I tried again changing the Vhost poiting it the DocumentRoot to /var/www/html/myfolder . Then i made a .htaccess with

    RewriteEngine On
    RewriteBase /
    RewriteRule ^mysite/.*$ - [PT]
    

    and worked like a charm! the only thing left is that i have to write the full example.com/mysite/ in the first time.
    can any one help how to only write example.com/ and show example.com/mysite/ in the fist time?
    Can anyone help me how to only write the domain

1 Answer

This question was answered by @gncanhoto:

ok based on the gndo sugestion I tried again changing the Vhost poiting it the DocumentRoot to /var/www/html/myfolder . Then i made a .htaccess with

RewriteEngine On
RewriteBase /
RewriteRule ^mysite/.*$ - [PT]

and worked like a charm! the only thing left is that i have to write the full example.com/mysite/ in the first time.
can any one help how to only write example.com/ and show example.com/mysite/ in the fist time?
Can anyone help me how to only write the domain

View the original comment

Have another answer? Share your knowledge.