Welcome to WebmasterWorld Guest from 54.166.172.33
Forum Moderators: Ocean10000 & incrediBILL & phranque
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?example.com
RewriteRule \.(php)$ https://www.example.com/ [R,L,QSD]
But it only works if someone access this page:Do you mean that this does happen, or that this is what you want to have happen? Is "index.php" in fact the directory-index page for the assorted games? If so, you have to let it load internally, or nobody could ever play the games at all.
example.com/games/game1/index.php
So if they go to...
example.com/games/game1/
The index loads - but the htaccess doesn't catch this.
Options -Indexes
ServerSignature Off
RewriteEngine On
SetOutputFilter DEFLATE
#SetEnvIfNoCase Request_URI \.mp4$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png|swf|mp4|exe|zip|wav|)$ no-gzip dont-vary
RewriteRule ^(games|index\.php) - [L]
RewriteRule ^.*\.(css|txt)$ - [L]
RewriteRule ^(([a-z0-9\-]+/)*[a-z0-9\-]+)$ https://www.example-example.com/$1/ [R=301,L]
RewriteCond %{HTTP_HOST} !^(www\.example-example\.com)?$ [NC]
RewriteRule (.*) https://www.example-example.com/$1 [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?t=$1 [L,QSA]
ErrorDocument 418 /games/noname.html
RewriteCond %{THE_REQUEST} /games/\w+/
RewriteRule ^gamename/(index\.php)?$ - [R=418]
Instead of redirecting, make a special page that says something like “I’m awfully sorry, but you can’t get there from here” with a pretty link to the page you want people to use. (It doesn't have to be a 418 error. Make something up.) Or redirect R=301 to this page. The idea is that you're doing this for humans, and you should explain to them what's happening and why. Well, part of the why. You don't have to tell them that it's because you want them to see your ads first ;) http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriteoptions
RewriteRule \.(css|js|png|jpg) - [L]
and-that's-all, listing any supporting-file extensions that actually occur in the /games/ directory.