.htaccess: Rewrite to folder except if cookie exists or before a date bypassing WordPress rewrite -
I migrated here at the static site WordPress-based website, these days a lot of time. Once I have finished developing a WordPress website on a test server, I want to install it on the existing website domain, but without affecting the old static site - until the site is live.
My idea is to get the current non-wordpress website to a folder I can not believe it myself and other authorized people want to Czech via a cookie (it will be set through a simple "login" PHP file, because I fixed IP address ) Or if the current date and time are after the live date, then WordPress repeat rules repeat their course to give access to the WordPress website. Before I present or which will add a simple countdown timer on the old site will live automatically Live on the new site My simple login.php script like this :? I thought the following might be the best way to get it, but it does not work (I get an internal server error). The first section checks to see if the login cookie is present, and if it is not, and the current date and time is before 8 o'clock on July 20, 2012, then this request will be sent to Can anyone help me with whom I want to achieve? That is why it should do 500 deals with server error. The second thing about your rules is that the goal of the rule, / old / and to get all the requests to rewrite this folder (and hence Keeping all URLs for SEO purposes only).
& lt; Php setcookie ("Login to" "Login", Time () + 3600, "/"); ? & Gt; & Lt; H3 & gt; Welcome, you are logged in & lt; / H3 & gt; & Lt; P & gt; & Lt; A href = "/" & gt; Click here to go to the home page & lt; / A & gt; & Lt; / P & gt;
/ old / folder. I've modified the WordPress section to rewrite the
/ year / folder.
RewriteCond% {HTTP_COOKIE}! ^. * Login. * $ [NC] RewriteCond% {TIME} & lt; (. *) 20120720200000 RewriteCond% {REQUEST_URI} ^ / year / RewriteRule http://domain.com/old/$1 [L] # Start WordPress & lt; IfModule mod_rewrite.c & gt; On RewriteBase / RewriteRule ^ index \ .php $ RewriteEngine - [L] RewriteCond% {REQUEST_URI} ^ / (old /.*)$ RewriteCond% {REQUEST_FILENAME} -f RewriteCond% {REQUEST_FILENAME} -d RewriteRule !. /index.php [L] & lt; / IfModule & gt; # END WordPress
RewriteCond takes command 2 argument, but Compare
% {time} and that cause Apache to return a 500 server error .. if you see, there can be no space after the comparator (mod_rewrite That way is dumb). So that the line requires something to look like:
# here in a place ----- V. RewriteCond% {time} & lt; 20120720200000
http://domain.com/old/$1 , redirect to Apache 302, Code> http://domain.com if you want to rewrite it internally (hence the URL does not change in the address bar of the browser), then you have to delete that bit.
Comments
Post a Comment