Redirects
-
If i want to redirect my old site (moving it to a wordpress site) so my old .htm EG http://www.mysite.co.uk/rec.htm to http://www.mysite.co.uk/rec/
can i do this in root custom code or is it a case of putting in something else?
-
I need more information. Are you trying to redirect individual matching htm pages to WordPress posts/pages or are you trying to redirect the entire root html site to the WordPress installation folder /rec/?
Well, i currently have a site with 30+ pages all end in /something.htm and i want to eventually redirect the /something.htm to /something/ in WP. so basically redirect a whole site with pages ending .htm to a wp site. A few end in .html but not many
do you have indentical matching posts/pages? have you created the WordPress posts yet? Will the posts have different names than the htm files/pages?
Hi, well i am currently working on site. Trying to keep names the same. So if i had http://www.mysite.co.uk/rec.htm
it will be http://www.mysite.co.uk/rec/
or
http://www.mysite.co.uk/photo.htm will become
http://www.mysite.co.uk/photo/These will all be pages.
Ok since you only have a very small number of html pages that you want to redirect and this is a work in progress then this is the best route to take. Use individual RedirectMatch directive rules. You can add them one by one as you create the corresponding new WordPress post.
Note: This redirect code will go in the root htaccess file of your html site or if the html site and the WordPress site are in the same folder then this code will go in your BPS root htaccess file in the Bottom Root Custom Code text box for htaccess redirect code.
RedirectMatch 301 ^/rec.htm$ http://www.mysite.co.uk/rec/ RedirectMatch 301 ^/photo.htm$ http://www.mysite.co.uk/photo/ ...or if you want to create post names that are different than the original html file/page.... RedirectMatch 301 ^/rec.htm$ http://www.mysite.co.uk/point-to-another-post-name-1/ RedirectMatch 301 ^/photo.htm$ http://www.mysite.co.uk/point-to-another-post-name-2/
Thank You.
So in my case, currently the .htm site is on another server. I will change name servers so my new site is on a totally different server. My old server will not be accessible after this.I assume search engines will then look on my new server for say http://www.mysite.co.uk/rec.htm and i will redirect to http://www.mysite.co.uk/rec/
so in this scenario am i putting in BPS root htaccess file in the Bottom Root Custom Code text box for htaccess redirect code
and if it was a html
RedirectMatch 301 ^/photo.html$ http://www.mysite.co.uk/photo/Is that CUSTOM CODE BOTTOM HOTLINKING/FORBID COMMENT SPAMMERS/BLOCK BOTS/BLOCK IP/REDIRECT CODE: Add miscellaneous code here
Yep that is a DNS thing. ie once the DNS propagation is complete for your new name servers/website/domain/etc. then it does not matter where your site exists physically.
Yes to html
Yes to Custom Code BottomExcellent thanks so much for your help and time!
Hi sorry one question, currently in that section i have
# BEGIN BPSQSE BPS QUERY STRING EXPLOITS # The libwww-perl User Agent is forbidden - Many bad bots use libwww-perl modules, but some good bots use it too. # Good sites such as W3C use it for their W3C-LinkChecker. # Add or remove user agents temporarily or permanently from the first User Agent filter below. # If you want a list of bad bots / User Agents to block then scroll to the end of this file. RewriteCond %{HTTP_USER_AGENT} (havij|libwww-perl|wget|python|nikto|curl|scan|java|winhttp|clshttp|loader) [NC,OR] RewriteCond %{HTTP_USER_AGENT} (%0A|%0D|%27|%3C|%3E|%00) [NC,OR] RewriteCond %{HTTP_USER_AGENT} (;|<|>|'|"|\)|\(|%0A|%0D|%22|%27|%28|%3C|%3E|%00).*(libwww-perl|wget|python|nikto|curl|scan|java|winhttp|HTTrack|clshttp|archiver|loader|email|harvest|extract|grab|miner) [NC,OR] RewriteCond %{THE_REQUEST} (\?|\*|%2a)+(%20+|\s+|%20+\s+|\s+%20+|\s+%20+\s+)HTTP(:/|/) [NC,OR] RewriteCond %{THE_REQUEST} etc/passwd [NC,OR] RewriteCond %{THE_REQUEST} cgi-bin [NC,OR] RewriteCond %{THE_REQUEST} (%0A|%0D|\\r|\\n) [NC,OR] RewriteCond %{REQUEST_URI} owssvr\.dll [NC,OR] RewriteCond %{HTTP_REFERER} (%0A|%0D|%27|%3C|%3E|%00) [NC,OR] RewriteCond %{HTTP_REFERER} \.opendirviewer\. [NC,OR] RewriteCond %{HTTP_REFERER} users\.skynet\.be.* [NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [NC,OR] RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC,OR] RewriteCond %{QUERY_STRING} \=PHP[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12} [NC,OR] RewriteCond %{QUERY_STRING} (\.\./|%2e%2e%2f|%2e%2e/|\.\.%2f|%2e\.%2f|%2e\./|\.%2e%2f|\.%2e/) [NC,OR] RewriteCond %{QUERY_STRING} ftp\: [NC,OR] RewriteCond %{QUERY_STRING} http\: [NC,OR] RewriteCond %{QUERY_STRING} https\: [NC,OR] RewriteCond %{QUERY_STRING} \=\|w\| [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)/self/(.*)$ [NC,OR] RewriteCond %{QUERY_STRING} ^(.*)cPath=http://(.*)$ [NC,OR] RewriteCond %{QUERY_STRING} (\<|%3C).*script.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^s]*s)+cript.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (\<|%3C).*embed.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^e]*e)+mbed.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (\<|%3C).*object.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^o]*o)+bject.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (\<|%3C).*iframe.*(\>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} (<|%3C)([^i]*i)+frame.*(>|%3E) [NC,OR] RewriteCond %{QUERY_STRING} base64_encode.*\(.*\) [NC,OR] RewriteCond %{QUERY_STRING} base64_(en|de)code[^(]*\([^)]*\) [NC,OR] RewriteCond %{QUERY_STRING} GLOBALS(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} _REQUEST(=|\[|\%[0-9A-Z]{0,2}) [OR] RewriteCond %{QUERY_STRING} ^.*(\(|\)|<|>|%3c|%3e).* [NC,OR] RewriteCond %{QUERY_STRING} ^.*(\x00|\x04|\x08|\x0d|\x1b|\x20|\x3c|\x3e|\x7f).* [NC,OR] RewriteCond %{QUERY_STRING} (NULL|OUTFILE|LOAD_FILE) [OR] RewriteCond %{QUERY_STRING} (\.{1,}/)+(motd|etc|bin) [NC,OR] RewriteCond %{QUERY_STRING} (localhost|loopback|127\.0\.0\.1) [NC,OR] RewriteCond %{QUERY_STRING} (<|>|'|%0A|%0D|%27|%3C|%3E|%00) [NC,OR] RewriteCond %{QUERY_STRING} concat[^\(]*\( [NC,OR] RewriteCond %{QUERY_STRING} union([^s]*s)+elect [NC,OR] RewriteCond %{QUERY_STRING} union([^a]*a)+ll([^s]*s)+elect [NC,OR] RewriteCond %{QUERY_STRING} \-[sdcr].*(allow_url_include|allow_url_fopen|safe_mode|disable_functions|auto_prepend_file) [NC,OR] RewriteCond %{QUERY_STRING} (;|<|>|'|"|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|drop|delete|update|cast|create|char|convert|alter|declare|order|script|set|md5|benchmark|encode) [NC,OR] RewriteCond %{QUERY_STRING} (sp_executesql) [NC] RewriteRule ^(.*)$ - [F,L] # END BPSQSE BPS QUERY STRING EXPLOITS
would i just add those redirects before # END BPSQSE BPS QUERY STRING EXPLOITS
Nope. You would cut and paste the Query String Exploits htaccess code to the correct BPS Custom Code text box. Then add your redirect code to the BPS Custom Code Bottom text box. Then do the Custom Code setup steps.
Sorry copied wrong code would i just add to bottom?
# BRUTE FORCE LOGIN PAGE PROTECTION # Protects the Login page from SpamBots, HackerBots & Proxies # that use Server Protocol HTTP/1.0 or a blank User Agent RewriteCond %{REQUEST_URI} ^(/wp-login\.php|.*wp-login\.php.*)$ RewriteCond %{HTTP_USER_AGENT} ^$ [OR] RewriteCond %{THE_REQUEST} HTTP/1\.0$ [OR] RewriteCond %{SERVER_PROTOCOL} HTTP/1\.0$ RewriteRule ^(.*)$ - [F,L] # BLOCK/FORBID Spammers etc Order Allow,Deny Deny from 195.88.31.48 Deny from 46.105.105.217 Deny from 95.211.156.228 Deny from 178.162.199.35 Deny from 178.162.199.78 Deny from 178.162.199.70 Deny from 95.211.159.93 Deny from 95.211.159.66 Deny from 178.162.199.87 Deny from 186.87.168.204 Deny from 187.94.215.191 Deny from 187.6.232.44 Deny from 151.77.47.183 Deny from 151.77.47.183 Deny from 187.6.232.44 Allow from all # WP AUTHOR ENUMERATION BOT PROBE PROTECTION # Redirects to author=999999 that does not actually exist # which results in a standard 404 error. To the hacker bot # it appears that this author does not exist without giving # any clues that the author does actually exist. RewriteCond %{QUERY_STRING} ^author=([0-9]){1,}$ [NC] RewriteRule ^(.*)$ $1?author=999999 [L]
The redirect htaccess code is stand-alone htaccess code so it can go anywhere in the Bottom Custom Code text box. The order is not important. It can go before, after or anywhere inbetween the code you posted above. Personally I choose to add redirect htaccess code last after all other code in the Bottom Custom Code text box just for the simple reason that it is visually easier and simpler to manage. I have quite a lot of redirect htaccess code on some of my websites.
Ok appreciate that.
- The topic ‘Redirects’ is closed to new replies.