The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Change to php file type or use mod rewrite

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #34519

    I am working on making a mobile site version for a well established site.

    I have a php script that will detect mobile devices and send them off to the mobile pages page, or leave them on the existing pages for desktop devices. The script works well in testing.

    But, all the pages on the site are regular html files, rather than php files.

    I guess I have two choices.

    Convert them from html to php. This seems like it could have some short to medium term SEO issues that I would rather avoid.

    Or, I think I can use some clever mod rewrite rule to get around this file type issue. Can I get some guidance on how to do this.

    Or is changing the file type the way to go?

    Thanks for your assistance.


    You can use the .htaccess file to parse php language on html files, (if your hosting options, hosting plan and server type allow this), or you can switch the extensions to .php, (and use the .htaccess file to 301 redirect those old .html urls to the newer .php urls if this site has been launched and there are incoming links from various places or search engines have indexed the .html links, so you don’t lose seo. You could also use mod_rewrite to hide the .php extensions OR rewrite them back as .html). That’s all I can think of.

    I wouldn’t mind seeing your php script btw if you don’t mind :)



    I think I understand the ways to do this, but don’t know how to evaluate the pros and cons of each technique. I have done more reading, and I think the mod rewrite technique is the way to go. Now I just need to find a tutorial.

    I am using this code.

    a bargain at $4. It works in my tests, and seems pretty straightforward, and is easy to install.


Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.