I have just finished configuring my LAMP environment on new macbook but would like to go a little further.
My home dir is as follows:
var/www/
site1.com
site2.com
site3.com
I would like my localhost homepage to automatically display a link for each folder within my home directory. Could anyone point in my the right direction for a solution to this?
create links to each folder in your homepage
site1
site2
site3
I used PHP for this, making use of "glob"
<?php foreach (glob("*", GLOB_ONLYDIR) as $filename) {
if ($filename != "project_thumbs") {
echo '<a className="project" href="/'.$filename.'/"><img src="project_thumbs\/'.$filename.'.png"></img><h3>'.$filename.'</h3></a>';
}
} ?>
Related
Ok, brand new Windows 10 Installation without IIS or Skype (Port 80 is open).
Installed WAMP 3 64bit version Worked like a charm!
Changed the httpd.conf file so I could redirect the www folder to D:/www/
Deleted the Old www folder and copied all my projects to the new folder at D:/www/(each project within it's own folder) leaving www root folder without a index.php or any other type of index file
Ok now comes the problem... Restarted all services, and when typing localhost or http://localhost/, on any browser, it gives me 404 Not Found...
If I try to access localhost/site1/ (for example) everything works fine so WAMP is working...
But...
On Linux it used to list all folders so I could click on them like a dir list a sort of navigation structure...
Why Wamp is not doing the same?
Maybe something to do with .htaccess? And if So, how to resolve it?
Thanks in Advance
JohnnyBR
This is not an answer to this problem but it works! It's a bypass!
After reading all guides I could found, creating .htaccess files, changing conf files and everything, I couldn't fix this problem (I didn't wanted to try understanding virtual hosts... If I got that right I'd have to make a virtual host for each site... not the thing I want)
So I made a quick fix and here it is:
I created a index.php with this code
<?php
$d = dir(".");
echo "Path: " . $d->path . "\n";
echo "<ul>";
while (false !== ($entry = $d->read())) {
echo "<li><a href='{$entry}'>{$entry}</a></li>";
}
echo "</ul>";
$d->close();
?>
And that's it folks! Same effect! If apache is not helping nor wamp server PHP will do it!
I am running XAMPP 1.8.2
Inside of htdocs folder I have a several sites.
Now I downloaded a working website from my hosting/server and found out that the identical copy of that website run on Xampp [http://localhost/mysite] can not find the images.
It is looking for images on
[http://localhost/img/myimage01.jpg] instead of
[http://localhost/mysite/img/myimage01.jpg]
I read some solutions but they all come to pointing the whole thing to [http://localhost/mydomain]
I would prefer if I can tell XAMPP to look for files for every domain from it's own root directory.
How can I do this?
Thanks
The easiest way is to create separate virtual host for each site folder in /htdocs
So you will access the http://mysite.local instead http:// localhost/mysite
There are two things to do:
1. edit C:\xampp\apache\conf\extra\httpd-vhosts.conf (by default) adding something like
<VirtualHost *:80>
ServerName mysite.local
DocumentRoot C:/XAMPP/htdocs/mysite
</VirtualHost>
2. edit c:\windows\system32\drivers\etc\hosts adding
127.0.0.1 mysite.local
restart xampp and try http://mysite.local
You generally can't move a whole website from http://<somedomain> to http://<somedomain>/<somefolder>. Things are bound to go wrong with links between pages in the site and links within pages to images.
Let's say you are displaying images within HTML web pages using image tags like this:
<img src="img/myimage01.jpg"></img>
This will probably work as the browser will look for the img folder in the same folder as the web-page.
On the other hand if your image tag looks like this (note the extra /) you will have the problem you describe:
<img src="/img/myimage01.jpg"></img>
The extra / means the browser will look for the img folder at the root of the domain.
I've setup my apache server on Centos 6.4 . But when i run my page, browse displayed Apache test page, What wrong i did?
In /var/www/vhosts/testing.page, my file "index.php" is:
<?php
echo 'Welcome, Trien';
?>
My virtual host:
![virtual host][1]
And my page displayed:
![Browse display][2]
Any help?
thank
Delete the index.htm or index.html if exist.
Also, check the permission for the file, make sure it has 'execute' permission.
Does anyone know how to go about displaying a custom homepage when Pubby is the root of Apache Tomcat?
My current setup is \Tomcat 6.0\webapps\ROOT\ <- Pubby folders WEB-INF and static are in this folder.
Whilst creating custom pages for e.g. localhost:8080/About is completely fine, (I just create a folder within my webapps folder called "About", and put my index.html in there), I don't how to get a custom index.html to display when I navigate to localhost:8080
I've tried sticking index.html files across my directories, but localhost:8080 won't resolve to any of them.
Thank you!
The index files for http://localhost:8080/ will be defined in $CATALINA_BASE/webapps/ROOT/WEB-INF/web.xml with defaults taken from $CATALINA_BASE/conf/web.xml
Assuming the ROOT app does not specify any welcome pages then an index.html placed at $CATALINA_BASE/webapps/ROOT/index.html should do the trick.
I've been working in a local dev environment for some time now with Codeigniter v1.7.1, and I recently installed xampp to replace it. Before, I had modified my hosts file and added a the virtualhost in my httpd.conf file, and my website was running at dev.mysite.com.
After installing xampp, the html is displaying when I go to the url localhost/mysite, however, none of the paths are working correctly, because they are formatted relative to the site root, which apparently is not being set correctly.
For instance:
<script type="text/javascript" src="/public_scripts/homepage.js"></script>
is pointing toward the URL localhost/public_scripts rather than localhost/mysite/public_scripts.
I went into config.php and changed the base_url to a number of different things, such as mysite/, but nothing worked.
What can I do to get CI to use localhost/mysite as the root, so that relative paths formatted like /public_scripts/script.js use mysite as the base url and not localhost?
Thanks!
In your hosts file (C:\WINDOWS\system32\drivers\etc\hosts) add
127.0.0.1 dev.mysite.com
In your virtual host file for that site check the DocumentRoot has 'mysite' in it
c:\xampp\apache\conf\extra\mysite.com.conf
DocumentRoot C:/path_to_my_website/site/www/htdocs/mysite/
Are you using the base_url in your views?
<script type="text/javascript" src="<?=base_url()?>public_scripts/homepage.js"></script>
This is just about your /etc/hosts and xampp httpd conf file - you must set up mapping 127.0.0.1 dev.mysite.local or whatever the local domain should be and then add virtualhost like you did before, no way to do this in CI or .htacces.