Forums

Rewrite rules for web.config needed (5 posts)

  1. Ravi
    Member
    Posted 8 months ago #

    Hi,

    Our WP runs in a Windows server

    and have a permalink format like

    /index.php/%year%/%monthnum%/%day%/%postname%/

    We changed this to

    /%postname%/

    and it works without any problem.

    But the old /index.php/%year%/%monthnum%/%day%/%postname%/ URLs are throwing 404 errors. What rewrite rule should I add to web.config to redirect them properly?

    Thanks,

    Ravi

  2. duck__boy
    Member
    Posted 8 months ago #

    WP should do that for you when you change your permalink structure, unless it is unable to write to .htaccess.

    I also use /%postname%/ and here is exactly what is in my auto generated .htaccess file (works fine if I enter the other structure too) -

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

  3. Ravi
    Member
    Posted 8 months ago #

    duck_boy,

    I am using a Windows server. So, there is no .htaccess.

    I have only web.config and WP could already make the permalinks working properly.

    But I could not get the old URLs to redirect to the new ones properly.

  4. duck__boy
    Member
    Posted 8 months ago #

    Ah, sorry - didn't twig on that bit.

    As far as I know WP is designed to run on Apache, not ISS (although it clearly can), so there may be some missing functionality in relation to this. Unfortunatly I'm not an expert with ISS, but I hope you find your solution.

  5. SwansonPhotos
    Member
    Posted 6 months ago #

    Please see this example and carefully review what each line does before using as is:

    http://pastebin.com/MnDgNisg

Reply

You must log in to post.

About this Topic

Tags