admin on April 6th, 2012
Today I've started making sitewide login form for WordPress based site with specific scripts.
wp-login.php uses redirect_to variable. That mean - after login user can be redirected back to the page where he was before. We must send this info to wp-login.php
So, for complete my login form I needed the value of current URL.
WP has function get_permalink(), but I needed something like this for script that is not under WP control.
And get_permalink() will cut GET request. For example if the user is on the page http://host.com/jobs/?query=nurse&location=CA after login he will be redirected to http://host.com/jobs/
There are lots of variants of code I found. For example specific functions like this or this.
That's too huge code for me and mostly for those who uses specific ports maybe.
But all I need is just the value of the URL in user address bar!
I found pretty good code here.
It checks the URL only if it HTTP or HTTPS, and that's enough!
After little minimization I've got this:
1
2
| $url = (!empty($_SERVER['HTTPS'])) ? "https://" : "http://";
$url .= $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; |
VN:F [1.9.17_1161]
Rating: 10.0/10 (1 vote cast)
admin on January 18th, 2007
Working on many projects I am constantly facing the task of changing or (more often) creating .htaccess file. There is no reason to mention once again that its installment is very important for SEO purposes, but some people are not still aware of it.
At first it was like a nightmare: so many info on the Internet that I could not decide what advice to follow. .htaccess description on Apache's official site is very nice but not for optimizers - rather for tech-gurus. Then I followed the experience of other sites, and tried to implement their examples on my projects. A better result but still unsatisfied - too many variants as many people there are.
And finally I've found (I believe) the core variant accessible for all. Try to install it on your server and you must forget about 301 redirect.
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^www.nokeywordinurl.com$ [NC]
RewriteRule ^(.*)$ http://www.nokeywordinurl/$1 [R=301,L]
- this part should redirect all non-www requests to www.nokeywordinurl.com
RewriteCond %{THE_REQUEST} ^.*/index.php?
RewriteRule ^(.*)index.php?$ http://www.nokeywordinurl.com/$1 [R=301,L]
- and this one redirects your index.php (in my example) to www.nokeywordinurl.com/ . In case you have index.html - just change php to html or whatever you have.
VN:F [1.9.17_1161]
Rating: 0.0/10 (0 votes cast)