Local site redirect to wrong address - php

So i have Ubuntu 16.04 with apache2 installed on it, and my local sites are inside if /var/www/html/ directory.
The problem is that one of my sites based on magento 1.9 redirect me to wrong url everytime. Whenever i'm trying to access localhost/my-site/ it redirects me to localhost/my-site/localhost/my-site/ instead.
I have tried to change .htaccess and even deleting it from site root folder same as changing apache2 hosts configurations inside of apache2/site-available folder and even creating new virtual host in that folder but that didn't helped.
I also tried to fully reinstall apache but no result. My hosts file has just localhost defined now so it can not be conflict with other host.
I think that it replace index.php url part with localhost/my-site but i have no idea how to fix it.
I would realy appreciate some help becose i'm trying to fix this few day already with no result.
Thanks.

Ok, I have solved this problem, by deleting cache folder on my local pc in /var/tmp directory. Apparently this cache was saved when i got redirect first time and after that i was redirecter becose of this.
Hope this will help someone.

Related

Xampp Settings for localhost

I cant see my xampp settings: using this URL http://localhost/xampp/
This is the result im looking for:
I dont know why but if i look at examples, everyone's URL looks like http://localhost/xampp/ if i use this Url i get a page saying:
Object not found! The requested URL was not found on this server.
The directory is located in C:\xampp, and if i just add http://localhost/ as domain i get the tree structure of everything within C:\xampp\htdocs.
Also using Xampp v3.2.2 , if im in control panel and click on the Apache Config tab it open my file structure as mentioned above everything within C:\xampp\htdocs.
I just want to mention im using Windows, not Mac, but i meen both windows and mac has these Apache settings afcourse, i just dont get it how i cant find it using http://localhost/xampp/.
Apache & MySQL is switched on.
What i think could be the problem:
Could it be that im missing the /xampp directory within the /htdocs directory ?
Im not sure if there should be a xampp directory in htdocs but its the
only thing that makes sense?
Possible reason: Something is running with port 80
when you run Xampp, check the apache port no. ex: if it is displaying port 8012
then your url is http://localhost:8012/dashboard/
Check Directories for Xampp
Xampp directories.
more about this topic
For check all dependencies in the : httpd-xampp
The only reason i see is the xampp file should be located in the htdocs folder at least that is how i have it.
However i do not think that this will cause a problem for you in developing anything.
Hope this was helpful :)

WAMP does not open my project

I am completely new to web-dev and wamp, I have to use it for a college project to build a website using php. I installed the newest version of wamp. I cloned my project repository into the www folder.
When I run "localhost" in the browser, I get the generic wamp page and I can see my project folder on the bottom of the page under the "Projects" heading
when I click on the project it does not open and I get a 404 not found error. This is not the same issue a thousands other people have written about, where when they uses the path "localhost/projectname" they get access to their project but when they just click their project the path is "projectname" and they dont see their project. I have read tons of posts with people that have that problem and I do not think I have the same issue becase when I click on my project link on the wamp hompage, I get the complete path "http://localhost/PaperCloudBackend/" and this shows a 404 error
Keep in mind that all I have done with wamp so far is:
1) install it
2) clone repo into www folder
3) opened browser with localhost
4) clicked on my project name
I would really like a concise answer to why this is happening so I can learn the root cause, and also a solution to the problem because i have not contributed to my team codebase at all and I have not been able to solve this issue after 1 week.
Thanks
I assume that its an .htaccess error which is clashing . If you have .htaccess in your project then check it if you have given the correct url in the .htaccess rule or you can delete the file(.htaccess) and run the project in your browser.
Another problem that you should check is there any index file is present in the root of the folder you are trying to access.
I hope this might help you.
Currently thats also happed with me on window8.1, To prevent this open the index.php file from root directory wamp/www/index.php.
Change
$suppress_localhost = true;
To
$suppress_localhost = false;
Hope this will help you to fix the problem.
Please make sure that index file exist in your "PaperCloudBackend" directory as it is the entry point of execution.

Configure WHM Main IP to redirect to an specific account

I'm working on a project that has a single domain on a WHM Server. So we access through an IP to the Wordpress Installation that is on the only account (Cpanel): server/~account1/.
To be more clear, when we access to http://xxx.xxx.xxx/ we were actually accesing to http://xxx.xxx.xxx/~account1/.
After a server migration, however, this stopped working, so we are trying to make it work again. I'm trying to figure out what is wrong here.
Now when we browse to http://xxx.xxx.xxx/ we get the default webpage http://xxx.xxx.xxx/cgi-sys/defaultwebpage.cgi, but we can access the real directory by typing the /~account1/.
Can you help me to figure where to start looking or what could be the problem? Could i fix it by editing the httpd.conf?
I'm a programmer but not an expert of server configuration so I'm kinda lost.
httpd.conf would be the place to start.
You are looking to check the Virtual Hosts setings, often in the above file or conf/extra/httpd-vhosts.conf
http://httpd.apache.org/docs/2.2/vhosts/examples.html
If all else fails, try running the httpd.conf rebuild script as root:
/scripts/rebuildhttpdconf

Cannot remove index.php from url CI based site

I have Code Igniter based site and I have it on ubuntu 12.04 in /var/www/mysite folder
My ubuntu serves as a server so I access my site trough other computer, but both computers are on LAN network. I use http://xxx.yyy.zzz.ttt/mysite url to access it.
The problem I have is that I cannot use url without "index.php" in it.
So I have http://xxx.yyy.zzz.ttt/mysite/index.php/phpinfo To acces my controller phpinfo instead of http://xxx.yyy.zzz.ttt/mysite/phpinfo
I have cheked well that mod_revrite works well with this here
And also checked that the folder, files and subfolders in mysite have all 777 file permissions.
I also added all necessary rules in .htaccess file but still no success
Any idea what is causing this.
The first thing I would do is make sure you followed all of the CI instructions.
It may be that you did not update the config file to be a blank string rather than using index.php
Do you know what was the issue.
The default file in sites-available had option
AllowOverride None for /var/wwww
I set it to All and it worked out. :)
cheers :)

CodeIgniter fresh copy works over LAN, but gets 403 over WAN

I'm starting a new CodeIgniter project, so I grabbed a fresh copy of version 2.1, and unarchived it to my local Apache root. I set up config.php and tested the site from localhost and another machine via the computer's LAN IP, and it worked as expected.
I also have my router forward WAN port 443 to port 80 on my server machine, so that I can access my Apache server from school (via wan_ip:443). This usually works fine, but when I try access my new CodeIgniter copy, I get a 403 Forbidden page.
I can still access all other sub-folders on my Apache server via WAN, including other, older, CodeIgniter projects.
There is no .htaccess file in the root of the fresh copy. I tried chmod-ing 755 and 777 recursively, but with no change.
Anybody have any idea what could be causing this? I've done quite a few CodeIgniter projects, and I've never had this issue.
I would have a look at the apache config maybe there is something related to the ip.
Also check your codeigniter config. Maybe it is doing some routing.
Try to replace your project with a simple index.html if that works apache is fine.
Check if your project itself does some redirect or something like this...
Turns out it was an Apache issue. I created an .htaccess file and added "Allow from all" to it, and now it works. I'm not sure why I needed to do that since I could access all my other Apache directories over WAN just fine, but it worked.

Categories