We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2605
    • 23 Posts
    Hey everyone,

    I’m setting a new site, and I have to keep the tilde in my address.

    My home address is:
    http://sub.domain.net/~user/

    I’ve set my .htaccess perfectly fine, and the mod_rewrite engine is loaded within apache.  This is my .htaccess:

    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php?q=$1 [L,QSA]


    Am i doing something wrong? I’ve never dealt with special characters, especially the ~ sign.  Is there something special that I must do? Any thoughts?? All help is GREATLY appreciated!

    Oh, I am getting 404 errors whenever i try to reach:
    http://sub.domain.net/~user/page.html
    My Tools->Configuration->Friendly URLS is set to use aliases, which is called page. There shouldn’t be any problems, as I did this with 2 other sites recently, but this site is set up a bit different. Again, thank you!
      • 22303 MODX Staff
      • 10,725 Posts
      This has nothing to do with the tilde in the URL; the problem more likely is your server configuration is not reporting the host name correctly. You should be able to force it to something specific (i.e. http://sub.domain.net/~user/) by setting the site_url value in your config file, or by authoring a plugin OnWebPageInit that sets the value of $modx->config[’site_url’] specifically.
        • 2605
        • 23 Posts
        OpenGeek,

        I tried editing the config file and changed the specific path, site came up just fine but still getting 404 errors when trying to navigate away from the index.

        I didn’t change the paths or anything, do I need to do that?
          • 22303 MODX Staff
          • 10,725 Posts
          What are the links being generated look like that are returning the 404’s?
            • 2605
            • 23 Posts
            The links look good. They are exactly what they should be..

            http://sub.domain.com/~user/about.html is the About Us Page, with alias: about


              • 24421
              • 44 Posts
              Perhaps it is a stupid question, but: Allows your server .htaccess files? I say this because it took me several hours of tests before giving account of which the problem was in the server. (Now SOLVED)

              After solving the problem, I added a Troubleshooting section to the how-to ’Friendly URLs Guide’ in the wiki.

              Hope this help,
              Ramon
                • 2605
                • 23 Posts
                Success!

                Had to change the RULE, not the base, as I originally thought..
                New .htaccess file:

                Options +FollowSymlinks
                RewriteEngine on
                RewriteBase /
                RewriteCond %{REQUEST_FILENAME} !-f
                RewriteCond %{REQUEST_FILENAME} !-d
                RewriteRule ^(.*)$ /~user/index.php?q=$1 [L,QSA]
                


                Thanks everyone smiley
                  • 15001
                  • 697 Posts
                  Changing the RewriteRule and not the RewriteBase worked for me too. Thanks.

                  The only thing that I cannot get rid off is "/~user/" in the path.
                  Any way to hide it?