Jump to content

PHP codes in .html files?


gravereaper

Recommended Posts

i've read somewhere that URLs like:yoursite.com/file.php?var=1&var=2can be converted into URLs like:yoursite.com/file.php/1/2or something similar, which i guess makes the search engines able to read them better or something. and i think in the PHP config you can change what files are parsed.

Link to comment
Share on other sites

You can configure your server (Apache, IIS, etc.) to parse PHP files under any sort of extension, be it PHP, HTML, XHTML, XML, or anything else of your bidding.Again, with server configuration, you may also rewrite folders to query strings to folders. That is turn

file.php?var1=1&var2=2

into

file.php/1/2

or better yet:

file/1/2

Don't do it if it's only for SEO though. Search engines list all files that have the MIME type text/html, as well as few other MIME types. They don't care of the exntension of the file. Just it's MIME type.

Link to comment
Share on other sites

Place this line in your .htaccess file to have html files parsed through the php parser so that all your file extensions can remain html, but the files can contain php code snippets. It works the server a bit harder and slows done the serving of files, but unless you are extremely busy, the clients will never notice.

AddType application/x-httpd-php .html .htm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...