Url rewriting not working with wordpress unless using [R]

后端 未结 1 1882
情深已故
情深已故 2020-12-04 03:52

I have a Wordpress installation on my website on the folder blog-ita/. Now, I\'d like to add a rewrite rule to allow accessing it from website-name/blog/<

相关标签:
1条回答
  • 2020-12-04 04:13

    You can follow this guide from Wordpress to get Wordpress to work in a different directory than wordpress is actually located.

    You want to install wordpress in the blog-ita directory. You want the url to show website-name/blog instead. Follow the following steps:

    1. Go to the "General" panel in your admin section and change/check the following boxes, then save the changes:
      • Site address (URL): Change this to http://example.com/website-name/blog
      • Make sure that WordPress address is correctly configured as htttp://example.com/blog-ita.
    2. Copy the index.php and .htaccess files in /blog-ita and paste them in /website-name/blog. You need to copy, not move.
    3. Open the index.php file in /website-name/blog in your favourite text editor and change the line that says require( dirname( __FILE__ ) . '/wp-blog-header.php' ); to point at the same file in the directory where wordpress is installed. In this case it should be changed to require( dirname( __FILE__ ) . '../blog-ita/wp-blog-header.php' );. Save the changes.

    From this point on, wordpress should be available at http://example.com/website-name/blog/. The admin section is only available at the actual installation directory (/blog-ita/admin).

    0 讨论(0)
提交回复
热议问题