Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I'm getting pretty confused my htaccess file.

If I use the following directives:

RewriteCond %{REQUEST_URI} distribute$
RewriteRule (.*) BalanceManager.php [L]

Then I expect https://somehwhere.com/distribute to redirect to https://somehwhere.com/BalanceManager.php with POST data in place... this is exactly what happens, which is great.

I also expect https://184.22.345.77/distribute to redirect to https://184.22.345.77/BalanceManager.php with POST data in place. It does NOT do this, it throws a 404 not found.

I need this to work on IP addresses and under SSL protocol, but have failed to get anything to work yet.

Is there a right way to do this? Are there alternative ways to acheive this?

I can address the file directly, using https://somehwhere.com/BalanceManager.php and that works, but when I look up https://184.22.345.77/BalanceManager.php in my browser, it throws a 404.

The host is within the Amazon Web Services architecture, and importantly... I am using a load balanced Wordpress site.

Cheers!

share|improve this question

migrated from stackoverflow.com Oct 5 '12 at 11:50

This question came from our site for professional and enthusiast programmers.

1 Answer 1

up vote 1 down vote accepted

I need this to work on IP addresses and under SSL protocol, but have failed to get anything to work yet.

Your IP is probably pointing to your default vhost and not the vhost that serves somehwhere.com. That's why you can't get to https://184.22.345.77/BalanceManager.php. Additionally, your SSL certificate won't work for an IP address if you've made the CA-Request for somehwhere.com. Browsers will load it and give you a certificate error because the IP isn't somehwhere.com.

If you don't care about the certificate error, you could add this line to your somehwhere.com vhost config (inbetween the <VirtualHost> </VirtualHost> block):

ServerAlias 184.22.345.77
share|improve this answer
    
That's a good idea but unfortunately going to 184.22.345.77/anything-u-like does work (unsure now if it shows a certificate error, don't think it does). This is a Wordpress site.. I need to override the default routing for WP I think, will try again tomorrow. –  AlexW Oct 4 '12 at 19:19
    
Actually I see what you mean now (still haven't had a chance to work on it). I may need to use the server's internal network IPs instead... –  AlexW Oct 7 '12 at 21:51

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.