I have the requirement of running the Wordpress admin over https.
We use a cdn to deliver cached content for the site but the cdn cannot accept secure traffic (only one SSL cert per IP allowed, and we run several sites off it). I cannot control redirects for httpS://www.mysite.com/.
I would like to have:
http://www.mysite.com/blog/
httpS://secure.mysite.com/blog/wp-admin/
httpS://secure.mysite.com/blog/wp-login.php
I have tried rewriting the urls as suggested in the article http://codex.wordpress.org/Administration_Over_SSL#Virtual_Hosts.
Hypothetically, you could use a host with a different name, such as wpadmin.mysite.com
Unfortunately trying this as suggested still sends me to httpS://www.mysite.com/blog/login.php.
# No matter what it redirects to the wrong subdomain for login.php
http://www.mysite.com/blog/wp-admin/
-> httpS://secure.mysite.com/blog/wp-admin/
-> httpS://www.mysite.com/blog/wp-login.php.
Also when directly going to the css files still link to the wrong url (.)
The simple solution would have been to run the blog off http://blog.mysite.com/blog/. Unfortunately this has been tried and was decided against for SEO reasons.
Is there anyway Wordpress can do this?
Have you looked into this thread? It is a mod on the WordPress HTTPS plugin.
Not too sure if you have seen this article but it's pretty comprehensive when it comes to Wordpress Admin over SSL. Scroll down to the part about Virtual Hosts, and there is information there about setting up the wp-admin as a subdomain.
http://codex.wordpress.org/Administration_Over_SSL
If you're using Apache to serve over SSL, look into mod_proxy.
Using it you can transparently redirect all requests from https://secure.mysite.com/blog/ to http://www.mysite.com/blog/.
The plugin http://wordpress.org/extend/plugins/admin-ssl-secure-admin/ is exactly what I was after.
Unfortunately its broken on newer Wordpress versions :(
To enable admin access for http://blog.example.com through https://ssl.example.com/wp-admins/blog/wp-login.php with pure Apache config so you have no dependence on Wordpress plugins and updates you may want to...
...use mod_proxy on an HTTPS apache virtual host to forward traffic, ensure ProxyPreserveHost is Off so that host names in the proxy statements are sent through to the wordpress server. Then mod_substitute is used (make sure to turn it on) to fix the broken links coming back from wordpress.
<Location /wp-admins/blog/>
AddOutputFilterByType SUBSTITUTE text/html
AddOutputFilterByType SUBSTITUTE text/css
AddOutputFilterByType SUBSTITUTE application/javascript
AddOutputFilterByType SUBSTITUTE application/json
Substitute "s|http://blog.example.com|https://ssl.example.com/wp-admins/blog|i"
Substitute "s|blog.example.com\\\/|blog.example.com\\/wp-admins\\/blog\\/|i"
Substitute "s|'/wp-admin|'/wp-admins/blog/wp-admin|i"
Substitute "s|\"/wp-admin|\"/wp-admins/blog/wp-admin|i"
Substitute "s|'/wp-includes|'/wp-admins/blog/wp-includes|i"
ProxyPassReverseCookiePath / /wp-admins/blog/
</Location>
ProxyPass /wp-admins/blog/ http://blog.example.com/
ProxyPassReverse /wp-admins/blog/ http://blog.example.com/
For the reverse proxy to work, you need to specify the internal IP of the server hosting blog.example.com. This solution ensures this will work even if the upstream server (10.0.0.4) has several name-based virtual hosts.
10.0.0.4 blog.example.com
For more details, see:
http://tec.libertar.se/how-to-host-wordpress-admin-on-a-seperate-domain-and-subfolder/
Related
I am using magento 1.9, I've got installed SSL which is working just fine.
The problem is when I am switching my secure link to https:// - all pages are working correctly, but pages such as checkout, register and login are throwing error 404, unless I manually add prefix with index.php
These links are working correctly when I am working with non-secure connections.
For example this links are working correctly:
http://myshop.com/customer/account/login/
http://myshop.com/customer/account/create/
But my links
https://myshop.com/customer/account/login/
https://myshop.com/customer/account/create/
are throwing HTTP 404 - Not Found - In order to make it work I have to manually add index.php prefix so my links look like this:
http://myshop.com/index.php/customer/account/login/
http://myshop.com/index.php/customer/account/create/
I have changed my .htaccess file, and I think the problem lies in this file. How can I edit this file so it fits my purposes ?
Any other solutions are more then welcome also.
The SSL has its own configuration files and sometimes when SSL does not work well, it may give the error of 404 (Page not found). Normally, the file name is http.conf or ssl.conf or default-ssl file which depends on your OS
Find here:
<Directory "path to your directory">
SSLOptions +StdEnvVars
AllowOverride All
</Directory>
make sure that AllowOverride All is present in your config
if it does not help attach what OS and web server you are using
Double check if you have enabled Web Server Rewrites
config > general > web > Search Engine Optimization > Use Web Server Rewrites > Yes
P.S restore the .htaccess file before try above method
Checked some of your website current pages such as https://www.myshop.com/registreren and it is working fine with https.
I've googled the crap out of this problem and came up with nothing, so hopefully you guys can help.
Goal
Configure a reverse proxy (using Apache's mod_proxy) to enable access to an internal PHP application over the internet using mod_proxy_html to rewrite URLs in my application.
Problem Description
Consider landing.php with only this code:
redirect.php
and redirect.php with only:
<?php
header("Location:http://internal.example.com/landing.php");
?>
with this snippet from my httpd.conf
UseCanonicalName On
LoadFile /usr/lib64/libxml2.so
LoadModule proxy_html_module modules/mod_proxy_html.so
LoadModule xml2enc_module modules/mod_xml2enc.so
<VirtualHost *:80>
ServerName example.com
<Proxy *>
Order deny,allow
Allow from all
AllowOverride None
</Proxy>
ProxyPass / http://internal.example.com/
ProxyPassReverse / http://internal.example.com/
ProxyHTMLLinks a href #Commenting out this line fixes the problem, but I need it for rewriting
ProxyHTMLEnable On
RequestHeader unset Accept-Encoding
</VirtualHost>
When I go to http://example.com/landing.php and click "redirect.php" it should take me back to the landing.php page. Instead, I get a "This connection was reset" in Firefox, or "No data received" in Chrome. (FYI, going to http://internal.example.com/redirect.php redirects correctly.)
The Question:
Why the redirect would fail going through the reverse proxy, and how can I fix this?
Hints
I've discovered a few things that could be helpful...
I know that if I comment out "ProxyHTMLLinks a href", this will work correctly. But obviously, this is the rewrite functionality I need.
I can also change the redirect.php page to the following, this works correctly:
<?php
header("Location:http://internal.example.com/landing.php");
?>
random text
I guess this text somehow does something to the page or HTTP headers that make mod_proxy_html (or more specifically ProxyHTMLLinks) operate differently than without it.
I can also change the redirect.php page to the following and have it work:
<?php
header("Location:http://internal.example.com/landing.php");
header("Content-Type:");
?>
This works because ProxyHTMLLinks, by default, is only applied to Content-Type text/html files. However, I don't want to have to hack all calls to header("Location:...") to make this work. I don't mind changing all the calls to header("Location:..."), assuming what I'm changing is correcting a problem, not creating a hack.
Lastly, I've done some packet sniffing on the reverse proxy server and discovered that the header("Location:...") sends a HTTP/1.1 302 Not Found to the reverse proxy server, but it doesn't pass this through to the browser requesting redirect.php. When I try one of the "solutions" above, the 302 is then passed from the reverse proxy server to the computer requesting redirect.php.
My understanding is that the Location header should go to the browser, and then the browser should request the new location passed back. So it is failing because the 302 doesn't make it to the browser...
FYI, I've tried looking at the error logs to see if mod_proxy_html is failing somewhere, but I don't see anything, though I'm open to specific suggestions with regards to logging, since I'm not 100% sure if I'm setting the logging up correctly.
Sorry this is so long, just trying to be as specific as possible.
Thanks in advance!
I figured out the problem. I needed to explicitly pass the charset in the header Content-Type for this to work.
This was accomplished by adding:
AddDefaultCharset utf-8
to my Apache config file. This globally fixed all calls to header("Location:...") without having to add header("Content-Type:") or header("Content-Type:text/html;charset=utf-8") to each one of them.
In short, what I'm saying that the mod_proxy_html's ProxyHTMLLinks causes a 302 Found to not be forwarded from the reverse proxy server to the client if a) the content-type is text/html (and thus ProxyHTMLLinks) applies, b) the charset is not set and c) your page has no content passed back.
In my opinion, this is a normal scenario. Pages which process form inputs often meet all three criteria.
It's possible that for some reason this is the intended functionality, and that I'm doing something else wrong, but I can't see what that would be. At least there is an elegant workout here in case anyone finds it useful.
today im playing with domains with php,
example
www.wordpress.com is our main site
www.friend1.com is my new domain
www.friend2.com is my new domain
www.friend3.com is my new domain
to
www.friend1.com the same as www.wordpress.com/profile/friend1 ?
www.friend2.com the same as www.wordpress.com/profile/friend3 ?
www.friend3.com the same as www.wordpress.com/profile/friend2 ?
how do wordpress, etc do things like that? are they doing that in the server side ?
or there is a way doing stuff like that in php?
*edit
if you still dont get it,
heres a example. lets say you have a friend deviantart id at myfrienddeviantartid.devaintart.com and lets say you are the admin on deviantart. you want to make a addon service that your friend can park his own domain into deviantart.com.
This is traditionally done using mod_rewrite inside Apache's configuration. It remaps URLs.
For apache http server, it uses ProxyPassReverse directive from mod_proxy or directives from mod_rewrite
The directive ProxyPassReverse lets Apache adjust the URL in the
Location header on HTTP redirect responses. For instance this is
essential when Apache is used as a reverse proxy to avoid by-passing
the reverse proxy because of HTTP redirects on the backend servers
which stay behind the reverse proxy.
Suppose the local server has address http://wibble.org/; then
ProxyPass /mirror/foo/ http://foo.com/
ProxyPassReverse /mirror/foo/ http://foo.com/
will not only cause a local request for the
http://wibble.org/mirror/foo/bar to be internally converted into a
proxy request to http://foo.com/bar (the functionality ProxyPass
provides here). It also takes care of redirects the server foo.com
sends: when http://foo.com/bar is redirected by him to
http://foo.com/quux Apache adjusts this to
http://wibble.org/mirror/foo/quux before forwarding the HTTP redirect
response to the client.
For MS(R) IIS use Re-Write Module:
Easily replace Web application URLs to produce user and search engine >friendly results.
URL Rewrite permits Web administrators to easily replace the URLs >generated by a Web application in the response HTML with a more user friendly and search engine friendly equivalent. Links can be modified in the HTML markup generated by a Web application behind a reverse proxy. URL Rewrite makes things easier for outbound response content and headers rewriting with outbound rewrite rules that work with HTTP request and response headers and with IIS server variables.
Additionaly, you must make sure that subdomain is setup with DNS provider to pass all requests to main.
DNS Record Sample:
NAME TYPE VALUE
--------------------------------------------------
exampleXYZ.com. CNAME example.com.
example.com. A 192.0.2.23
Ref:
https://en.wikipedia.org/wiki/CNAME_record
http://www.akadia.com/services/apache_redirect.html
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
http://www.iis.net/downloads/microsoft/url-rewrite
I have django running with wsgi and apache.
I want to route some URLs to PHP part of the website. Because both the django/wsgi and PHP content requires SSL, I can't use virtual name hosting. How can I do this?
RewriteEngine in Apache config doesn't work, because there is no alternate NameVirtualHost to redirect to?
Can I have urls.py redirect to a PHP file, instead of a django application view?
Thanks!
You can put an alias to the php areas before your WSGIScriptAlias line in the virtual host section to get the desired result. I've just tested it:
alias /somefolder/ /srv/www.site.com/www/somefolder/
WSGIScriptAlias / /srv/www.site.com/myapp/app.wsgi
I can put php files into /srv/www.site.com/www/somefolder/ and they run as PHP.
Seems like it could be a major security issue as all requests are passed though Django when the Apache vhost has WGSI enabled. Just as it is not recommended to serve media though Django in production, this is likely not recommended.
That said, you might want to look at handling this like static media in PHP. Not sure that it will work, and I really would not recommend it, but you can give this a try:
urlpatterns = patterns(
(r'^php/(?P<path>.*)$', 'django.views.static.serve', {'document_root': '/abs/path/to/php'}),
)
Use a Content Delivery Network (CDN)
Compress components with gzip
Configure entity tags (ETags)
Add Expires headers
If i don't have access to Apache configuration.
Use a Content Delivery Network (CDN)
This involves changing your hosting (for at least some files)
Compress components with gzip
Configure entity tags (ETags)
Add Expires headers
You can either:
Get access to your Apache configuration
Get someone who does have access to it to change it
I find "HOW TO SPEED UP YOUR SITE AND GET A YSLOW GRADE" is useful for me. Hope this help.
If you have grade A on every other YSlow rule then you're doing pretty well already and don't need to worry about those items. By the way, you can create custom rulesets in YSlow that are more tailored to your needs and server setup. So if you can't change any of these things, just remove them from the rules that YSlow uses.
Use a Content Delivery Network (CDN)
You can add your site domain as a CDN in YSlow. The idea of this one is to store static components on different domains to increase "parallelisation" (downloading more files at once). If you are using limited hosting then you could open a separate account and host some files there on a different domain.
Compress components with gzip
You can do this in PHP, using ob_start('ob_gzhandler'); at the very start of your scripts. This is a little more resource intensive so use Apache if possible.
Configure entity tags (ETags)
Remove this from the rule list, it's not necessary in 90% of cases. Yahoo only says to remove them because in the rare situation you have multiple servers in the back-end, the same file might have a different ETag if it comes from a different server. When each file comes from one server then ETags are a good thing and removing them is detrimental.
Add Expires headers
If you have no access to the server then you probably won't be able to change this. Ask your host about it. You may be able to override the server setting in your .htaccess file. You'd need the mod_expires Apache module. This page has some usage examples.
Paste this code bottom of .htaccess file
RewriteEngine On
# BEGIN Mod Header
ExpiresActive On
# Turn on Expires and set default expires to 10 years
# END Mod Header
# BEGIN Cache Control
Header set Expires "Thu, 15 Apr 2012 20:00:00 GMT"
Header unset ETag
FileETag None
#END Cache Control