Forum Moderators: open
Finally i found a way to show my php files as html. I wanna ask will it help to get more ranking. Or it doesnt matter for google with or without question mark.
Thats the way how i made it:
I have thousands of hotels, thats why i am using php. They all stored in MySQL.
firstly I create a folder called "hotels". I have sent a .htaccess file. it includes this line (Only one line).
ErrorDocument 404 /hotels/
It means when a client request a non existing file under hotels directory, it will go directly to index.php in hotels folder.
eg. Requested file is like that: hilton_234.html
234 is hotel id in my database. index.php will find 234th hotel from database and it shows hilton hotels details.
What do you think guys, will it helps to get more ranking.
Thanks in advance
"ErrorDocument 404 /hotels/" is not a good idea. Currently, Google will not index URLs that return a 404 error, and (unlike /robots.txt excluded URLs) Google will not even list 404 URLs in the results. The PageRank is still split by links to 404 pages, so links to other (non-404) pages will not get the PageRank that they would if the links to the 404 URLs weren't there.
Using .htaccess in Apache, "RewriteRule ^/somepath(.*) /otherpath$1" would seem a good answer to your problem; you may need a "RewriteEngine on" directive first. See Apache's documentation for mod_rewrite [httpd.apache.org].
Create a file called 'hotels' with no extention and program it to go fetch your data based on the query string. For example, lets say you have 2 query vars $country and $hotel (I'll come back to this)
In your .htaccess write this. It will force apache to treat the hotels file as a php script.
<Files hotels>
ForceType application/x-httpd-php
</Files>
Now, back to your hotels file:
To grab the query files do something like this:
$path_info=explode("/", $_SERVER['PHP_SELF']);
$country=$path_info[1];
$hotel=$path_info[2];
// Do the rest of your page generation.
So you end up with urls like this.
www.site.com/hotels/denmark/somehotel
Hope that's clear, I've got a bit of a hangover this morning ;)
Nick