Avoid webmail redirection - heroku

I have settled my domain and my app is running perfectly on Heroku with Flask. The problem is, my hosting (that only owns the domain) points the webmail as mydomain.com/webmail. But, my application thinks this URL is proper from the script and when it tries to load it, it gives a 404 error.
I've looked around and in the CPanel forum says I should add this:
ScriptAlias /webmail /usr/local/cpanel/cgi-sys/wredirect.cgi
ScriptAliasMatch ^/webmail/(.*) /usr/local/cpanel/cgi-sys/wredirect.cgi
to the httpd.conf file, which I don't know where to locate. Is there any way around this?

Related

Redirect all requests from xyz.herokuapp.com to new provider

I have moved a website from heroku to another provider. Lets say its custom domain is www.mysite.org. It was also at mysite.herokuapp.com, although we never really used that domain, Google has indexed some pages there. I want to redirect any requests mysite.herokuapp.com/[EVERYTHING] to www.mysite.org/[EVERYTHING]. The paths are otherwise compatible. I am told Heroku does not allow you to use an .htaccess file. I've deleted the mysite project on Heroku but could create a new one thats a simple php page or something else?
I'm sure this has been asked before, i've looked but find either too little or too much information and none seems to answer my question. Thanks.

GoDaddy does not show newly added file

I uploaded a new .php file to GoDaddy via Cpanel. It works on my local, but when I try to run it on live, it shows 404 on console. Seems like it cannot see the new file.
Is there some sort of latency on Godaddy servers like uploaded files appear X hours later or something? Or what may be wrong?
Nope Cpannel is pretty close to instant. Be sure your .php file is named index.php and is in a folder that has the desired url. (This may not be what’s preventing you from seeing the file, just a common issue I’ve seen that’s on the quick check list.) do not use capital letters or spaces when naming your index file.
You also get hosting support over the phone with godaddy. This is there number. +1-480-463-8389.
But feel free to use their url to find their support number.

Images from website not working for server root

I am hosting multiple websites on the same server. Instead of uploading the (same) pictures for each website into individual folders, I would like to make ONE main folder on the server where all websites will get their image from, so I dont end up with duplicates.
I tried everything but cannot seem to get it working. Can anyone help me out?
Hosting on Ubuntu 16.04 with Apache2.
My host file:
Alias "/product-image" "/var/www/uploads"
<Directory /var/www/mysite.com/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
So basically what I want is when my SRC goes to:
mysite.com/product-image/ferrari/f1.jpg
it should be served from
/var/www/uploads/ferrari/f1.jpg
Tried multiple tutorials but nothing worked so far.
P.S. when I go to the url mysite.com/product-image I would expect to see my upload folder but I see nothing. Instead I get an error:
Not Found
The requested URL /product-image was not found on this server.
Apache/2.4.18 (Ubuntu) Server at bedrijfskledinggroothandel.nl Port 443
If you have your multiple websites set up as subdomains in your hosting (as I do), each website at run time can only see the files in or below its specific subdirectory - the hosting will put this layer of security in place.
If this is your own server, not externally hosted, the same may well apply but you may perhaps be able to override this element of the configuration (if you want to - to me, the reason for this security layer is to prevent users realising the stuff is in the same place and trying to take advantage of the fact in some way).
You could however get to what I think is your objective by putting a http (not file level) redirect in place (via .htaccess) so that the subdomain interpreted https://my-website.com/Images (or whatever) as https://www.my-main-domain.com/central-image-directory, which would do the trick I think.

Redirecting from one domain to another with mod_rewrite

I've set up a site for someone that has a URL like:
www.flowers-oakville.com.
But they'd also like www.flowersoakville.com to land on the page.
The question now is, what is the best way to redirect from www.flowesoakville.com to www.flowers-oakville.com. I don't want the user's browser to show the redirection by showing the new URL in the address bar so I think Apache's Redirect command is not the solution. Plus, the Apache Redirect would take an extra trip to the browser and back that I'd like to avoid. So I think the solution needs to be a mod_rewrite, which as I understand it, does everything within the server so the round trip is avoided and the user's address bar is unchanged.
But after reading through a few mod_rewrite tutorials, it seems that mod_rewrite is mainly for redirecting files, not an entire website. Is there a simple way to do this?
Thanks for any help.
I would do this at the domain level and ensure you are using relative links or an environment variable for the hostname in the website.
Add www.flowersoakville.com as a CNAME record pointing to www.flowers-oakville.com.
This will then serve the same website, but retain the domain name as the user entered it, unless you have explicitly linked the actual domain in a link somewhere in the site.
If mode_proxy
is enabled on your server, you can use mod_rewrite (the following code) in your .htaccess file to redirect a domain to another domain without changing url in the address bar.
Try adding this to www.flowersoakville.com/.htaccess file :
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?flowersoakville\.com$ [NC]
RewriteRule ^ http://www.flowers-oakville.com%{REQUEST_URI} [L,NE,P]
Note : The example above will not work if proxy module is not enabled on your server.
I wanted to pass on my experience trying to use Dwev's answer. It turns out that the DNS Manager running in my virtual server (I'm using eApps as my hosting provider) does not support "domain based redirection." That is, the left side of a CNAME record has to be in that domain. So when trying to build a CNAME record in the flowers-oakville.com record that points to flowers-oakville.com, the left side has to be xxx.flowers-oakville.com where the xxx might be something like www. I can't get the left side to be flowersoakville.com, even though flowersoakville.com is one of the domains my server is listening for.

Cant serve pages created with Yii framework on localhost on Mac

I had a website I designed in the Yii framework. I had to move it over to a new Mac because the old one was dying. I moved everything over, but I cannot access the webpages from the browser, I get a 403 forbidden error. I CHMOD'ed the files to see if that would help, but to no avail. I cannot seem to find the answer on the Yii forums, either. Seems NO files on this site can be accessed even though file permissions are wide open. I cannot seem to find anything in htaccess or httpd that helps. Any ideas on how I tell Yii/Apache that it's ok to serve these pages?
EDIT:
So I see this in the apache2 error_log file:
Options FollowSymLinks or SymLinksIfOwnerMatch is off which implies that RewriteRule directive is forbidden: /Users/me/Sites/website/index.php
Weird. When I uploaded the site from my old computer to the web I never got any 403s but on this mac only I get this.

Resources