Last active
September 28, 2017 07:04
-
-
Save johnbocook/38098ba6712e7318c9e0a69eaae8052c to your computer and use it in GitHub Desktop.
htaccess stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^example.com$ [NC] | |
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} ^example.com [NC] | |
RewriteRule ^(.*)$ http://www.example.com$1 [L,R=301] | |
RedirectMatch 301 ^/blog/(.*)$ http://blog.example.com/$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<IfModule mod_rewrite.c> | |
RewriteCond %{REQUEST_URI} /+[^\.]+$ | |
RewriteRule ^(.+[^/])$ %{REQUEST_URI}/ [R=301,L] | |
</IfModule> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?domain\.com/ [NC] | |
RewriteCond %{HTTP_REFERER} !^$ | |
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/dontstealmyimages.jpg [L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Options +FollowSymLinks | |
RewriteEngine on | |
#======================================================================== | |
# FIRST Handle the http requests first before removing the additional url junk | |
#======================================================================== | |
#rule for graffiticaps.com to link to one directory | |
RewriteCond %{HTTP_HOST} ^(www.)?graffiticaps.com$ | |
RewriteCond %{REQUEST_URI} !^/one/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /one/$1 | |
#rule for usacapinc.com to link to two directory. Its the same as above just with usacapinc.com URL and subfolder | |
RewriteCond %{HTTP_HOST} ^(www.)?usacapinc.com$ | |
RewriteCond %{REQUEST_URI} !^/two/ | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d | |
RewriteRule ^(.*)$ /two/$1 | |
#========================================================== | |
# SECOND Remove the additional url junk once the new url is loaded | |
#========================================================== | |
#rule for graffiticaps.com url rewrite to remove /one/index.php from the URL | |
RewriteCond %{HTTP_HOST} ^(www.)?graffiticaps.com$ | |
RewriteRule ^(/)?$ one/index.php | |
#rule for usacapinc.com url rewrite to remove /two/index.php from the URL. Again its the same as above just with the usacapinc.com URL and sub folder info. | |
RewriteCond %{HTTP_HOST} ^(www.)?usacapinc.com$ | |
RewriteRule ^(/)?$ two/index.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RewriteEngine On | |
RewriteCond %{HTTP_HOST} !^yourdomain.com$ [NC] | |
RewriteRule ^(.*)$ http://yourdomain.com/$1 [L,R=301] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Blocks direct access to wp-comments. | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{REQUEST_METHOD} POST | |
RewriteCond %{REQUEST_URI} .wp-comments-post.php* | |
RewriteCond %{HTTP_REFERER} !.*yourdomainname.* [OR] | |
RewriteCond %{HTTP_USER_AGENT} ^$ | |
RewriteRule (.*) ^http://%{REMOTE_ADDR}/$ [R=301,L] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment