ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Need to add .html extension to ee urls

September 23, 2011 5:50pm

Subscribe [4]
  • #1 / Sep 23, 2011 5:50pm

    rbboyl

    38 posts

    I am importing an html website into EE for a friend.  Is it possible to add the .html extension to the end of the urls for all the ee pages?  Would it be done through htaccess?

    Reason for this: he would rather keep the urls in his site the same since the content will be the same (just in EE instead of an html page) and the site is indexed already.  Would prefer not to do a 301 redirect for all the pages if he doesn’t have to.

    Thanks!

  • #2 / Sep 23, 2011 7:35pm

    Mark Bowen

    12637 posts

    Hi rbboyl,

    You can add in .html to URL titles in ExpressionEngine and then that should get you what you need here without the need for any .htaccess rewrites.

    Does that help at all?

    Thanks,

    Mark

  • #3 / Oct 06, 2011 12:46pm

    rbboyl

    38 posts

    Thank you for your help.  Question about that.

    Let’s say the original file was domain.com/about.html

    The about page has a different layout than the index page, so I need a to create a new template called “about”.  In this case, if I add .html to the url title - wouldn’t the url now be domain.com/about/about.html?

    Is there a better way to do this?

  • #4 / Oct 07, 2011 8:52am

    Sue Crocker

    26054 posts

    Hi, rbboyl.

    Yes, you could use the Pages module and remove index.php via .htaccess to accomplish this. You’d tie the about entry to a particular template and display that.

    Does that help?

  • #5 / Oct 07, 2011 10:36am

    rbboyl

    38 posts

    I tried that and for some reason it doesn’t work.  I made the page url to be about.html and also in the Pages Tab set the page uri to be /about.html and assigned it to the about template.  When I go to domain.com/about.html, it sends me to the index page (as if they can’t find the page).

    However, when I change the page url to be about_our_company and the page uri to about_our_company and then go to domain.com/about_our_company, the page shows up fine.

    It looks like the page url doesn’t like having the .html extension in it.

    -Rich

  • #6 / Oct 07, 2011 11:04am

    Mark Bowen

    12637 posts

    Hi Rich,

    Do you perhaps have a .htaccess file in use on your site at all?

    If you do can you possibly rename it to just htaccess (note the missing dot there) and place index.php back into your Admin > General Configuration preference and see if this still happens for you please.

    Thanks,

    Mark

  • #7 / Oct 07, 2011 11:55am

    rbboyl

    38 posts

    I do have .htaccess file in use.  I didn’t remove index.php from the admin-gen config preferences though, is that a problem.  Let me give your suggestion a try.

  • #8 / Oct 07, 2011 12:32pm

    rbboyl

    38 posts

    Mark, I tried to remove the htaccess from play and as a result, domain.com/about.html got the default “page not found page” for my host.  I tried domain.com/index.php/about.html and got “Input File Not Specified” with a blank page.

  • #9 / Oct 10, 2011 9:07am

    Sue Crocker

    26054 posts

    If you try domain.com/index.php?/about.html, does that work? You may need to force query strings.

  • #10 / Jan 26, 2012 2:06am

    rbboyl

    38 posts

    Just an update on this, I tried doing this on a different EE website using the Pages Module method that Sue suggested above and it seems to work.  However, the index.php has NOT been rewritten in the htaccess.  Once I remove the index.php, I will test again and give an update to see if it is still working.

  • #11 / Jan 30, 2012 7:47pm

    Shane Eckert

    7174 posts

    Hello Rich,

    Please keep us posted on the results of your test.

    I hope things are sorted out for you.

    Cheers!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases