custom url instead of having localhost - macos

I have a folder called example inside htdocs in XAMPP , so I access my url with localhost/example/ . How can I have just example/ instead of localhost/example/ when I type my url ? Thanks in advance!
I've tried editing DocumentRoom in apache htdocs and it didn't work...

I'm not sure if that helps you, but you have to set the html root into your example folder to be able to use localhost/ only. Maybe you can move all contents of the example folder to the parent directory and try again.
If you want to use a real URL like example.com/ instead of localhost/ you can edit your hosts file
sudo nano /etc/hosts
and add the following lines to the end:
127.0.0.1 www.example.com
127.0.0.1 example.com

Related

How to disable localhost/dashboard directory listing in xampp

Whenever I open localhost it redirects to this directory listing. Previously it used to show the index.html page "Welcome to XAMPP" now it shows directory listing. How do I revert it?
For whatever reason if xampp stops recognizing the dashboard index.html file simply edit xampp/htdocs/index.php file and edit the following line and add /index.html at the end of the line.
header('Location: '.$uri.'/dashboard/index.html');
This will make sure that the index.html is loaded rather than displaying the Directory listing.

Is it possible to get `www.mydomain.com/app` to point to `www.myapp.heroku.com`?

I have www.myapp.heroku.com and domain name www.mydomain.com.
Is it possible to have www.mydomain.com/app point to www.myapp.heroku.com?
Googling seems to only yield how to get www.mydomain.com to point to www.myapp.heroku.com. I can't find anything about forward slashes.
Try it with HTACCESS (If unknown create a blank file in your base directory and rename it to: .htaccess
Now add:
RewriteEngine on
Redirect /app http://www.app.yourdomain.com
Just tested it, will work (if your provider supports htaccess url forwarding)
Good Luck

edited hosts file and now localhost doesnt work

So I was trying to add an entry to my hosts file so that my testing environment would be at local.domain.com instead of localhost.
Now that I made edits, nothing is working, including localhost. I read somewhere that it has something to do with editing it in certain programs giving weird errors so to open it in something else and save it. I tried that and still nothing.
Is there any way i can just 'reset' this file? Or any ideas anyone has?
did You try this:
127.0.0.1 localhost
::1 localhost

how to change web server folder location in xampp

I have installed xampp and by default my website files are stored in htdocs. How do I change the webdirectory path?
Edit the file /opt/lampp/etc/httpd.conf and change the lines containing current web directory path. It should start with DocumentRoot. Update all the places having the current path to the path you would like it to be.
It can be done by editing the "httpd.conf" file present in this path "\xampp\apache\conf\".
Change the line that starts with "Directory ...".
Note that all the lines that start with a hash (#) are just comments and are there just to describe the commands present there in the file.
search for the file "httpd.conf" and change the path in that file.
change localhost's name ? thus instead of having localhostdomain/webdirectory
you may have newdomain/webdirectory ?

vhosts not working on windows 7 using wamp

i'm having trouble setting up vhosts on windows 7. i'm running wamp.
my host file includes:
127.0.0.1 local.tribune.com
i've included httpd-vhosts.conf from within my httpd.conf.
my httpd-vhosts.conf includes:
<VirtualHost *:80>
DocumentRoot "c:/wamp/www/"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "c:/Users/Name/My Documents/the tribune/website/local.tribune.com/"
ServerName local.tribune.com
</VirtualHost>
here's the weird thing..if i remove the 'My ' from the DocumentRoot, then going to localhost in a browser works and i can see phpmyadmin, but i can't see the contents of the directory because the path is incorrect. but soon as i put that 'My ' in the path, the wamp icon never goes white (it stays yellow), and i can't reach localhost or local.tribune.com.
soon as i remove the 'My ' again, localhost will work again.
i've seen multiple posts around this issue on wampserver.com and elsewhere, but none of them answered or resolved. most that are resolved are basic issues like not including or having deleted httpd-vhosts.conf, missing characters, etc.
Its never a good idea to have a space in your directory path. URL Encoding interprets it as: "%20%". I would suggest placing your website files on D:/websites/local.tribune.com
you can read more about URL Encoding here
Hope that helps
solved it. was close before, but just missed it.
in windows 7, the path is NOT:
c:/Users/Name/My Documents/the tribune/website/local.tribune.com
but is actually:
c:/Users/Name/Documents/the tribune/website/local.tribune.com
to prove this, click at the end of a path in a windows explorer window, and the full path is displayed in plain text.
also, just because i've seen some disagreement online, in my experience:
the drive letter is case insensitive
the slashes can go either way
trailing slashes have no effect
path names CAN have a space in them

Resources