Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps - Status | Demo | Docs | Install
  1. Cloudron Forum
  2. LAMP
  3. Redirect domain root to "/site" subfolder

Redirect domain root to "/site" subfolder

Scheduled Pinned Locked Moved Solved LAMP
3 Posts 2 Posters 851 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rchau
    wrote on last edited by
    #1

    Hi,

    I have my personal site in a subfolder of my domain, e.g. https://example.com/site.

    Going to example.com shows the default Cloudron LAMP page. I want to redirect visitors to the .com address to example.com/site
    I have created an .htaccess file in the root directory with the following code

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteRule ^$ /site/ [L]
    </IfModule>
    

    But this doesn't work; no redirection occurs.

    I got this code from this Dreamhost article in the section:
    "Automatically load a subdirectory"
    https://help.dreamhost.com/hc/en-us/articles/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file

    I'd appreciate any help!
    Thanks!

    girishG 1 Reply Last reply
    0
    • R rchau

      Hi,

      I have my personal site in a subfolder of my domain, e.g. https://example.com/site.

      Going to example.com shows the default Cloudron LAMP page. I want to redirect visitors to the .com address to example.com/site
      I have created an .htaccess file in the root directory with the following code

      <IfModule mod_rewrite.c>
      RewriteEngine on
      RewriteRule ^$ /site/ [L]
      </IfModule>
      

      But this doesn't work; no redirection occurs.

      I got this code from this Dreamhost article in the section:
      "Automatically load a subdirectory"
      https://help.dreamhost.com/hc/en-us/articles/215747748-How-can-I-redirect-and-rewrite-my-URLs-with-an-htaccess-file

      I'd appreciate any help!
      Thanks!

      girishG Offline
      girishG Offline
      girish
      Staff
      wrote on last edited by
      #2

      @rchau said in Redirect domain root to "/site" subfolder:

      I have created an .htaccess file in the root directory with the following code

      you have to create this in /app/data/public/.htaccess (not inside /app/data) . Can you double check?

      1 Reply Last reply
      1
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #3

        https://stackoverflow.com/questions/990392/how-can-i-use-htaccess-rewrite-to-redirect-root-url-to-subdirectory has other ideas as well. If you want /site to appear in the browser URL, you can also do RewriteRule ^$ /site [L] (no trailing slash!)

        1 Reply Last reply
        1
        • nebulonN nebulon marked this topic as a question on
        • nebulonN nebulon has marked this topic as solved on

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Bookmarks
        • Search