Support » Fixing WordPress » Permalinks on moved installation

  • I’ve installed WP in a subdirectory and then recreated the htaccess and an amended index.php files in my root directory. I’ve changed the website address in general settings.

    If I change the permalinks to Postname, on typing the web address to the root, it redirects to the subdirectory and produces a 404 Page Not Found error. You can then navigate to all the necessary pages, but it looks cumbersome and pretty amateur. If I leave permalinks as plain, it works fine, but the urls don’t look pretty.

    Is there a way around this to get the Permalinks back working for the homepage?

    Thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • Let’s create an example so we’re sure we’re on the same page here as I got lost a bit on your steps of the subdirectory installation.

    main url is http://localhost and WordPress is located inside /wp folder.

    Your siteurl (wordpress) should be http://localhost/wp and the home (website) should be http://localhost. You should copy the .htaccess and index.php page in the root ( basically http://localhost) directory and edit the index.php changing the line:

    require( dirname( __FILE__ ) . '/wp-blog-header.php' );
    to
    require( dirname( __FILE__ ) . '/wp/wp-blog-header.php' );

    The only thing left would be to just go to permalinks and hit save again so WordPress can read the appropriate pretty urls.

    An extra note sometimes after moving WordPress you still have to do a manual search and replace to convert old urls to new ones if it was a migration. A plugin as https://wordpress.org/plugins/better-search-replace/ could easily do the job. Some themes + plugins are unfortunately hardcoding their urls when they create their options instead of using the core functions to retrieve it.

    Yes that is exactly what I did.

    my website is http://www.frampton.website
    This the code in my index.php in my root
    ( dirname( __FILE__ ) . '/wordpress/wordpress/wp-blog-header.php' )

    I currently have permalinks turned off. If you visit my site it works fine, except that permalinks are not on and the address appears in the menu bar as wordpress/worpdress. If I turn permalinks on, then typing frampton.website redirects it to frampton.website/wordpress/wordpress and it returns a 404 Page not found error, but then all the menu links etc work (including the Homepage link),

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Permalinks on moved installation’ is closed to new replies.