Please disregard the 'View article...' shown at the bottom of many posts as this is the result of restoring old forum posts from a backup.

Relocated Page from Dev Environment

I've relocated my site that was running in a local development environment onto a hosting location.  I've modified the config.php file to properly connect to the database and everything there seems fine, but I'm running into issues with 404 errors and missing images.

Is there a straightforward way for 'fixing' these path issues?  I believe the primary issue is that now everything is 'up' one directory, as where in my local dev environment the site is running in a sub directory.

Is this potentially an .htaccess issue... or something I can/should fix through Exponent?

Thank you.

Comments


  • What you're experiencing is that any image embedded within html/wysiwyg text (in the database) contains a hard url/path. This would also apply to many embedded links. However, most of the attached images and links are handled by Exponent dynamically and were automatically updated.

    You could probably accomplish it using one of these .htaccess rules, but I'm not an expert on that. Either/all should work, but may be dependent on your web host provider's specific server setup. Place it at the top of the existing .htaccess file.
    Redirect 301 /testfolder http://yourdomain.org/
    or
    RedirectMatch 301 ^/testfolder/$ http://yourdomain.org/
    or you could try
    RewriteRule ^testfolder/(.*)$ /$1 [R=301,NC,L]

  • Thanks Dave, I'll look into playing with the .htaccess file.

    When you say that exponent should have updated things automatically, would that have only been if I ran through an upgrade process or something?  At this point I pretty much just dropped the exponent system in place on the hosted server and linked up the database.

    I'm able to login to the site, but none of the other links work for managing the site... I get 404's.

    Thanks.
  • Regarding the 'automatic update'...that applies to things such as the navigation menus and attached images where the actual link is created on the fly as the page is built. If you are not able to access the Exponent menu items or your site navigation menu, it may be a web server URL Rewrite issue?
  • Thanks for the help.  I just had to tweak the .htaccess a bit.  Good to go.
  • Would you mind posting the fix here as a tip for the future. Many, including me work with subfolders in the test/pre-deployment environment.
  • # Don't show directory directory listings.

    Options -Indexes



    # Route requests to Exponent.

    DirectoryIndex index.php



    # Various rewrite rules.

    <IfModule mod_rewrite.c>

        RewriteEngine On



        # you may have to edit/uncomment the next line if working from a subfolder

        # RewriteBase /subfolder-name



        # To redirect all users to access the site WITH the 'www.' prefix,

        # (http://example.com/... will be redirected to http://www.example.com/...)

        # adapt and uncomment the following:

        # RewriteCond %{HTTP_HOST} ^example\.com$ [NC]

        # RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]

        #

        # To redirect all users to access the site WITHOUT the 'www.' prefix,

        # (http://www.example.com/... will be redirected to http://example.com/...)

        # uncomment and adapt the following:

        # RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]

        # RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] 

      

        RewriteRule ^$ index.html [QSA]

        RewriteRule ^([^.]+)$ $1.html [QSA]



        # Kludge out certain file types that we don't want to try to route thru the eXp router.

        RewriteCond $1 !^(.*\.css|.*\.js|.*\.pdf|.*favicon\.ico|robots\.txt|.*\.shtml|.*\.htc) [NC]



        # Kludge out image files that we don't want to try to route thru the eXp router.

        RewriteCond $1 !^(.*\.jpg|.*\.gif|.*\.png|.*\.jpeg|.*\.tiff|.*\.bmp) [NC]

        

        # These rules 

        RewriteCond %{REQUEST_FILENAME} !-f

        RewriteCond %{REQUEST_FILENAME} !-d

        RewriteRule ^(.*)$ index.php [QSA,L]



        # RewriteRule ^login.php$ login/showlogin



    </IfModule>



    ErrorDocument 403 /index.php?controller=notfound&action=handle_not_authorized&error=403

    ErrorDocument 404 /index.php?controller=notfound&action=handle&error=404

    ErrorDocument 500 /index.php?controller=notfound&action=handle_internal_error&error=500
  • Sorry, I'm not seeing the change/fix in that posting
Sign In or Register to comment.