Plesk custom 404 page not working - apache

Using Plesk 11. The custom error docs is working for inside the httpdocs folder for the vhost, but it is not working for the other domains outside the vhost.
For example, my vhost is called ns304346.ovh.net. If I go to http://ns304346.ovh.net/thiswontwork.lol it takes me to the predefined 404 page inside the error_docs folder.
However, in this webspace I also have the domain jaycraft.co inside the ns304346.ovh.net vhost folder, but not inside the httpdocs folder. This all works great, except instead of jaycraft.co using the error_docs 404 page, it just goes to the index file.
For example, http://dev.jaycraft.co/thiswontwork just goes to http://dev.jaycraft.co/thiswontwork showing the index page.

Seems like your website has some internal redirecting/rewriting or rewriting in .htaccess, because the following configuration is works for me:
/var/www/vhosts/domain1.com/ <- my main domain
/var/www/vhosts/domain1.com/domain2.com/ <- additional site on same subscription
/var/www/vhosts/domain1.com/error_docs/not_found.html <- custom error document
When I open domain1.com/not_exists OR domain2.com/not_exists - it's shows 404 error with content from /var/www/vhosts/domain1.com/error_docs/not_found.html

Related

Accessing contents from a symbolic link created in htdocs

We have set up apache server and created a symbolic to logs folder.
Problem:
When we try access the logs using http:/server:port/logs the logs appear properly in browser. However when we are using big ip url that is http:/bigipurl/logs url rewrites as http:/bigipurl:port/logs and the page doesnt get displayed.
Observation:
If we use http:/bigipurl/logs/ logs are getting displayed.
Figured this out, Added directoryslash off under the respective directory section in httpd.conf file.

htaccess http request re-routing

Reason for Problem:
I'm working on a website and wanted to work on it without making edits to the live website. My hosting package allows for "infinite" domains. So instead of editing the live website I create a new domain, without purchasing the domain name and am trying to develop with this new domain.
Issue At Hand:
This issue is that the reference file paths don't work anymore and return 404 when trying to load the webpage. My original website directory structure looks like this
cgi-bin
config
public_html
->JSfiles
->CSSfiles
->PHPfiles
The new one is the same structure however when you open the "temporary web address" the URL looks like this
http://217.199.187.199/myTempAddress.com/"
instead of
http://myTempAddress.com/
so when my index.html file looks for /JSfiles/someJSfile.js its requesting
http://217.199.187.199/JSfiles/someJSfile.js
when it needs to be requesting
http://217.199.187.199/myTempAddress.com/JSfiles/someJSfile.js
Things I've Tried Unsuccessfully:
I would really like to fix this by redirecting with the .htaccess file in the root directory on the server. Ive tried using the following directives with no success.
Redirect /217.199.187.199/JSfiles/mustache.min.js http://217.199.187.199/myTempAddress.com/JSfiles/mustache.min.js
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/JSfiles/
Redirect /JSfiles http://217.199.187.199/myTempAddress.com/
Redirect /JSfiles 217.199.187.199/myTempAddress.com/
Question:
How can I redirect the requests to the right location? I need all the the requests to be of the form http://217.199.187.199/myTempAddress.com/someDir/Somefile.ex
You need to read up a bit more on Virtual Hosting in particular name based virtual hosting.
https://httpd.apache.org/docs/current/vhosts/name-based.html
It sounds like your provider might support name based VHosts but what you're trying to do is not taking advantage of that. To do what you want ie have path that points to a different version of your site is best achieved using mod_rewrite. See this
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
You need to make sure that your provided actually supports this.

Website not loading on LAMP but test page displays

I have set up my LAMP server on Ubuntu 14.04. I have created a virtual machine to host a website. The directory structure is:
var/www/DS/public_html
I have set up my configuration files so that the server responds to the url:
http://ds.local
I have created test pages inside public_html called index.html and index.php. I have modified the configurations so that index.php is the default page that gets served. In the test page named index.php, the only line of code is:
<?php phpinfo(); ?>
when I go to http://ds.local frrom my browser, the page gets served up and I can see all my php configurations. So. everything good till now.
I have a website which I had developed on WAMP. Now, when I try transferring the files of this website into public_html and try reloading the browser, nothing happens. I have looked at the developer tools window, and I am certain that no page loads.
I have ensured that I have copied all the files and folders making up the website, including all the folders containing js and css. I have also ensured that there exists a file called index.php
Where am I going wrong?
I have a website which I had developed on WAMP
Are you sure that all files are referenced by correct case?
Windows file systems are by default case-insensitive.
http://localhost/DS and http://localhost/ds
are same on windows but not on linux/unix.

Working with local and live websites. issues with subfolders in www folder

I have a live site, example.com and when i have pulled it off to a local enviroment using wampserver i am having some issues
on the live site everything works ok and if I click on a link it will resolve properly
example.com/offices
However on the localcopy because I have other sites in the www folder(as subfolders) I have to access it by
127.0.0.1:8888/example/
and when I click on the same link on the local website it will go to
127.0.0.1:8888/offices/
instead of
127.0.0.1:8888/example/offices/
And the same goes with images as the are all looking for folders in the root rather than the subfolder (www/example)
I have tried using virtual hosts and couldn't get it to work
is there a rule I can put in the htaccess or would I need a seperate install of wamp so it all resides in the www folder?

XAMPP Error with using ErrorDocument in .htaccess

I am using a .htaccess file for a short url system that I made. It is supposed to use a file, sudir.php, to find the url that the "code" that was entered is for. But whenever I goto the page at http://localhost/shorturl/t10m3S which doesn't exist so it is supposed to redirect with sudir.php, but it only takes me to a generic "Not Found" page.
This is what i have in my .htaccess:
ErrorDocument 404 /shorturl/sudir.php
If I change it to my phptesting folder, it shows the index of that folder. If I change it to just the shorturl folder, it still gives me the generic 404 error page. If I remove it completely it shows the default page from Apache. So it basically seems like Apache or .htaccess or something doesn't know that the shorturl folder exists even though I can access it and it works. It seems all I need is for it to acknowledge that the folder is there and actually load the sudir.php file, but I don't know what to do.
Additional Info:
I am using a .htaccess file in a different directory to redirect to YouTube pages like how youtu.be does and it works perfectly fine. I did have the same problem with it though at first, but I just renamed the folder it was in and changed the .htaccess to correspond and it started working. I have tried the same with shorturl, but it did not work.