XAMPP - how to set root folder of website in htdocs? - redirect

I installed XAMPP and created simple website (a folder 'website' in htdocs folder) that contains a link Info.
If I type localhost/website in browser I get a default homepage. But if I click the link, it goes to localhost/info (which does not exist), instead of localhost/website/info. I could use <a href="/website/info">, but it would be weird to refactor all the links when changing site name.
So what is the usual setting or solution that people uses when developing sites in XAMPP?

You have to change DocumentRoot in httpd.conf file to folder. In your example where you have website directory.
For more sites, you have to have more hosts and then set virtual hosts.
Here is link how to do that in Win. But point is the same in all OS.

Related

can't connect local site to Iphone with XAMPP

Ive build my site on wordpress and using xampp
i want to test my new dev site on my remotely on my iphone and ipad via wifi
They're both connected to wifi
When i search iphone http://000.000.0.00 or http://000.000.0.00:80, :8080
it comes up with a link to a folder , which is my true path
when i click on this next sub folder , i loop back round to 127.0.0.1
As i guess iphone doesn't know where to find my site contents
I've tried renaming my wordpress site the with the http://ipaddress, :80, :80;80
ad it comes up with an error
ive found in my XAMPP index.php file
The footer seems to send me to 127.0.0.1/dashboard/
i can view this from my iphone
i've tried changing that footer on index.php to my site path
As well as deleting the file all together
Deleting the file allowed me to access more folders but not into the subfolder where my site remains
I've read through questions and tutorials but can't seem to find a solution
i was wondering if i've missed something or if i need to configure files in such a way , maybe to this index.php for XAMPP itself to get it to point at my site as a default
Thank you in advance
Check if your files are in htdocs or you have given correct path to your working directory in your httpd.conf file.
If the directory is correct and you have run your php pages already, I suggest you use ngrok for remote connection to your localhost.
https://ngrok.com/download
it is simple to use.
to run it go to the directory of ngrok in cmd and type ngrok http 80 while your XAMPP servers are running. It will provide a link that could be accessed through internet by any device.

Deploying a Static website on Server

I am trying to built a static website using godaddy server. I created a folder say Manage inside public_html in which there is an index.php. Now when I am trying to open this page on browser with URL "www.mysite.com/Manage/index.php" It is showing error, File not found, 404 error. So what possible error I might be making?
There could be a few reasons. If you are using an RHEL-based distribution for your server, you need to edit the master Apache configuration file /etc/httpd/conf.d/userdir.conf and change two things:
Change UserDir disabled to UserDir disabled root
If #UserDir public_html is commented change it to UserDir public_html
This tells Apache that the directory containing each user's html files is a subdirectory of their home directory called public_html.
You may also need to change the permissions of your user directory and your public_html directory to allow Apache to read and execute inside them. To do this, run the following commands:
sudo chmod o+x /home/myusername
sudo chmod o+rx /home/myusername/public_html
Restart Apache and see if it works.
The source for this knowledge is not my brain. It comes from the wonderful course at Washington University in St. Louis CSE 330 Rapid prototype development.
At first look to error.log. If you use nginx find in /var/log/nginx, if httpd in /var/log/httpd.
And what do you mean about "static"? PHP preprocessor generate html from *.php files, so you index.php is not static.
For this case you need to setup LAMP stack.

Deactivate/change default favicon in iPlanet 6.0

While there are many questions here about a favicon not showing, I have one that is showing out of nowhere...
If I type in my browser http://localhost, I see the root of the web directory and no favicon.ico is there. Yet an icon shows up on the browser tab. If I type http://localhost/favicon.ico, the browser does show me the icon!
How can http://localhost/favicon.ico return something that does not exist?
I am using an iPlanet server linked to weblogic app container.
I searched for a favicon.ico in my entire web directory and weblogic domain, didn't find any (or rather: some others lying around but not the one I see).
I even searched for the string 'favicon.ico' in domain, web directory and iPlanet directory, in case it is in some configuration file, didn't find anything.
Any hint?
Edit: As pointed out by Sacha below, this is a default icon of the server. I would like to know where in the config it is located, and how to deactivate it. I found how to do that in documentation of iPlanet 7.0, but I am using iPlanet 6.0 and I can't find anything in the doc.
If there is no favicon.ico server displays a default one.It might be a xampp or wamp logo.If you want to customize put yours in your project root directory. Eg:- If your project name is saas put it in saas folder.
If going to localhost/favicon.ico shows you the icon, then it is there. I am not sure why it is not in the directory.
I was also facing the same problem in jBoss server of my jsp project in which the browser was showing by default server icon and there was no favicon.ico in my whole project directory
then i searched for the favicon on the server and it was there so i have remove that file from the server to remove any default favicon from my project.

Change document-root on Shared-host?

When you deploy a Zend Framework website to a shared host, you usually cannot change the DocumentRoot to point at the public/ folder of the website. As a result the URL to the website is now http://www.example.com/public/.
Apart from choosing a proper host..there's any workaround?
thanks
Luca
If you have access to directories above public, you can put all non public files there.
Otherwise, you can put everything in a subdirectory, and block access to it with an .htaccess file.

Where is the web server root directory in WAMP?

Also is the web server root directory the place where you put your site files and later acces them with localhost/file_name in the browser?
If you installed WAMP to c:\wamp then I believe your webserver root directory would be c:\wamp\www, however this might vary depending on version.
Yes, this is where you would put your site files to access them through a browser.
In WAMP the files are served by the Apache component (the A in WAMP).
In Apache, by default the files served are located in the subdirectory htdocs of the installation directory. But this can be changed, and is actually changed when WAMP installs Apache.
The location from where the files are served is named the DocumentRoot, and is defined using a variable in Apache configuration file. The default value is the subdirectory htdocs relative to what is named the ServerRoot directory.
By default the ServerRoot is the installation directory of Apache. However this can also be redefined into the configuration file, or using the -d option of the command httpd which is used to launch Apache. The value in the configuration file overrides the -d option.
The configuration file is by default conf/httpd.conf relative to ServerRoot. But this can be changed using the -f option of command httpd.
When WAMP installs itself, it modify the default configuration file with DocumentRoot c:/wamp/www/. The files to be served need to be located here and not in the htdocs default directory.
You may change this location set by WAMP, either by modifying DocumentRoot in the default configuration file, or by using one of the two command line options -f or -d which point explicitly or implicity to a new configuration file which may hold a different value for DocumentRoot (in that case the new file needs to contain this definition, but also the rest of the configuration found in the default configuration file).
Everything suggested by user "mins" is correct, and excellent information.
WAMP 2.5 provides a default Server Configuration display when you enter localhost into your browser. This maps to c:\wamp\www, as described in previous posts. Creating subdirectories under www will cause Projects to appear on this display. A click and you're in your project.
I have various projects under different directory structures, sometimes on shared drives which makes this centralized location of files inconvenient. Luckily, there is a second feature of WAMP 2.5, an Alias, which makes specifying the location of one (or more) disparate web directories quite easy. No editing of configuration files. Using the WAMP menu, choose Apache > Alias directories > Add an Alias.
WAMP has evolved nicely to provide support for a variety of developer preferences.
If you use Bitnami installer for wampstack, go to:
c:/Bitnami/wampstack-5.6.24-0/apache/conf (of course your version number may be different)
Open the file:
httpd.conf in a text editor like Visual Studio code or Notepad ++
Do a search for "DocumentRoot". See image.
You will be able to change the directory in this file.
To check what is your root directory go to httpd.conf file of apache and search for "DocumentRoot".The location following it is your root directory
this is the path to the web root directory c:\wamp\www
you can create different projects by adding different folders to this directory and call them like:
localhost/project1 from browser
this will run the index.html or index.php, lying inside project1
Here's how I get there using Version 3.0.6 on Windows