• I have custom post review in that i am having url
    /review/abc.htm
    /review/temp/

    i want to support both the url in custom post . If i set in permalink only one of them work
    /%postname% or %postname.htm

    can anyone help me.
    Note: its migration and i need to insert this post from code. Even if from admin i need to change i can do.

    • This topic was modified 4 years, 9 months ago by mbandqs.
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    If the .htm file actually exists on your server, WP will not even get involved.

    If you want to migrate the .htm file content into WP, create posts or pages which use the same title slug as the original filename, without the .htm.

    Add a .htaccess rule to redirect all .htm requests to the equivalent WP post or page of the same name.

    If your server still has some actual .htm files that need to remain, you need to setup a rewrite rule set that excludes such requests from the redirect. A WP site wouldn’t normally have any requests from the public which involve file extensions. Only backend requests involve actual file extensions.

    Thread Starter mbandqs

    (@mbandqs)

    Thanks @bcworkz ,

    I want .htm file in same custom post in WP.

    i am adding post in custom post “review” in this few url post has ‘/’ ending and few has .htm

    In short my url will be

    https://www.example.com/review/abc/
    https://www.example.com/review/xyz.htm
    https://www.example.com/review/test/
    https://www.example.com/review/temp.htm

    so there are around 800 url so i could not add rewrite for all. And this we have multiple custom post .

    Hope this time I made more clear.

    Thanks and Regards,

    e

    Moderator bcworkz

    (@bcworkz)

    WP will place a trailing slash on all permalinks. I advise against attempting to create WP permalinks that look like file requests. If the WP page that contains the old .htm file content has the same name as the file. e.g. for a file named foo.htm, its content should go into a WP page named foo. If all pages are consistently named after the related file, one rewrite rule will handle all 800 requests. This is the power of regular expressions (regexp)
    http://httpd.apache.org/docs/2.2/mod/mod_alias.html#RedirectMatch

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Custom Post with multiple files extension’ is closed to new replies.