Wordpress Subdomain Post Link Throws 404

Discussion in 'General troubleshooting' started by JoeCBT, Feb 19, 2014.

  1. Hey guys,

    Sort of a newbie question but i need a little help. I have a main site that is an MVC4 installation and have set up a subdomain to operate a wordpress blog. The wordpress subdomain is blog and is directed to the blog folder. In order to do that i had to create a rewrite rule in the web.config. Here is where the issue lays. I can navigate to the blog correctly by going to blog.domain.com and it shows the wordpress install. However, when you click on a link like read more... it throws a 404 error. In the URL it shows blog.domain.com/postname however the Requested URL shows blog.domain.com/blog/postname

    After doing some digging im assuming it has to be my rewrite rule.

    <rewrite>
    <rules>
    <rule name="blog.domain.com">
    <match url=".*" />
    <conditions>
    <add input="{HTTP_HOST}" pattern="^blog.domain.com$" />
    </conditions>
    <action type="Rewrite" url="\blog\{R:0}" />
    </rule>
    </rules>
    </rewrite>


    Can someone help me out with a proper rewrite rule that will direct the subdomain blog.domain.com to the subdirectory blog but not insert blog into every URL request to ensure the links do not break.

    Thanks
    Joe
     
  2. ComputerMan

    ComputerMan Winhost Staff

    I think your rewrite code is wrong. Checked this web page article out. He talks about how to set up a subdomain name to use a subdirectory on Winhost using the URL Rewrite rule here: http://benpowell.org/Winhost-com-how-to-really-run-multiple-sites-under-one-account/

    Looks like you're using a back slash rather then a forward slash. (I could be wrong and I don't like working with URL Rewrite but that blog post article seemed to have helped a lot of people on Winhost.)

    Hope that helps ;)
     
    Last edited by a moderator: Oct 14, 2015
  3. Thanks for the link. Ive made the changes as described, However it still causes the same issue.

    here is where the blog is. You can see it loads fine, however when you click on a link it throws the 404. The rewrite rules are taking the link and and rewriting the request to include /blog/

    blog.craftbeertraders.com
     
  4. It is a rewrite issue and has to do with the Permalinks setup in Wordpress. I want it to look like subdirectories but it fails. Once i change it to the standard ?p=123 everything works as expected. For now i have changed the permalink structure. Hopefully someone has had this issue before and can help get everything working with the subdirectory permalink


    thanks!
     
  5. Still having issues. Can anyone help me with the Rewrites?!?
     

Share This Page