Forum Moderators: phranque
The script I use to run the site doesn't put anything in there once a game has been removed. I would like to know how to get it so that this page and any others I specify will return users to the frontpage ( http://www.example.com/games/index.php )
Can somebody please help me accomplish this?
Thanks for any help you can provide!
[edited by: jdMorgan at 6:28 pm (utc) on Mar. 4, 2008]
[edit reason] No URLs, please. See Terms of Service. [/edit]
If your website has an url like mentioned above (and you seem to have), and this is not a physical file within the file system but a dynamically generated url (and later rewritten by mod_rewrite to a physical filename), then Apache will not know nothing about it's status, can't find out that it exists or not. In such a case, your server-side script has to do the error handling, if the request is for a non-existing resource, then it should send back a 404 status code, with some explanation on the same webpage why it happens (or give suggestions where to look for a 'replacement'). This could look similar to your homepage, but it is strongly advised to avoid redirecting missing resources to your homepage just like that (SEO considerations).
I simply want to take those people going to those error invested pages to the front page so I can hopefully salvage some visitors from those hits I'm getting.
Is this possible? I don't know a thing about htaccess and need help on exactly what I should add to my htaccess if this is possible. You are right that those paths to actually exist on the server. There is not a folder called http://www.example.com/games/play-Kennel_Chaos and that it is all put together by the script on a page using template files that are used for all the media that exists on my site.
I will stop worrying about the problem if I know that htaccess cannot fix this problem and get visitors redirecting to my frontpage, but if there's a chance it will work, I'd like to try.
Thanks for any help you can provide.
So to get back to the htaccess way, you can do the following in a .htaccess file in your root:
Opetions +FollowSymLinks
RewriteEngine On
RewriteRule ^games/play-Kennel_Chaos/?^ http://www.example.com/ [R=301,L]
If you prefer to do it in a htaccess file, then you have to list each entry separately. If you ask me, implement this functionality in your script, it must be a matter of one or two lines...
Screw it, it's not going to work probably anyways.
Thanks anyways. I can't change the script, because I don't know coding and it's a script that I purchased that runs my site. I would have no idea where to look or what to add.
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^games/play-Kennel_Chaos/?$ http://www.example.com/ [R=301,L]
Alternatively you can use the mod_alias Redirect directive [httpd.apache.org] which would have the following syntax:
Redirect permanent /games/play-Kennel_Chaos/ http://www.example.com/
But keep in mind that it is generally a bad idea to redirect instead of returning an error status; when something can not be found, you have to tell the user agent (browser or robot) that it can not be found. You search rankings may be affected by ignoring such a thing.