WordPress.org

Ready to get started?Download WordPress

Forums

Localhost links incorrectly rewriting to live site (9 posts)

  1. bmd91
    Member
    Posted 1 year ago #

    Every link in my localhost redirects to the live site. The url before clicking reads localhost/blog/year/month/day/post but then redirects to live site homepage. I believe this is a problem revolving around permalinks, apache mod_rewrite but as far as I know I have my .htaccess setup correctly. Any help would be greatly appreciated

  2. ClaytonJames
    Member
    Posted 1 year ago #

    Did you do a search and replace on the database to replace all instances of the live site domain name with "localhost" prior to importing the database to the local installation? If yes, try making the local .htaccess file writable to wordpress, and then refresh/update the permalinks and see if that has any effect.

    Some documentation on Moving WordPress and a cautionary statement about serialized data and using plugins to search and replace in the database

  3. bmd91
    Member
    Posted 1 year ago #

    Thanks for replying ClaytonJames.

    I did in fact search and replace the domain name. If i change the permalink structure to default about half of the links work (mainly posts, but a few pages too) but most links to pages still rewrite to the live site. This is why I believe it's a mod_rewrite issue

  4. ClaytonJames
    Member
    Posted 1 year ago #

    Is mod_rewrite installed and working on the local server, and has the AllowOverride Directive for the local site been set to 'All'?

  5. bmd91
    Member
    Posted 1 year ago #

    Yes to both

  6. ClaytonJames
    Member
    Posted 1 year ago #

    Have you tried renaming/removing the old .htaccess file and creating a new, empty .htaccess then allowing WordPress to re-write/reset your permalinks?

  7. bmd91
    Member
    Posted 1 year ago #

    Yup. Tried that multiple times already. No resolution

  8. ClaytonJames
    Member
    Posted 1 year ago #

    This is just a stab in the dark at this point, but is there any chance that when you copied the live site files, you downloaded an active caching plugin and some cached files from the live site into the local site?

  9. bmd91
    Member
    Posted 1 year ago #

    Yes I am using a caching plugin. I tried removing and redownloading all the files except for plugins and emptied my cache. No luck

Topic Closed

This topic has been closed to new replies.

About this Topic