I used to use Apache + .htaccess to serve a index.html page in a subdomain. The .htaccess redirected every pathname in any subdomain to the index.html itself.
For example:
In http://path1.myserver.com/chat, chat wasn't treated as a path, but as a "parameter" to the index.html file.
Also, http://path2.myserver.com/chat would be redirected to the same index.html file.
When I changed the server to Node, I couldn't (shouldn't) use .htaccess anymore.
How can I move from Apache to Node, keeping this functionality?
I tried to use vhost + router, but unsuccessfully.
I can set vhosts to serve *.myserver.com to a specific router, so http://path1.myserver.com and http://path2.myserver.com are correctly redirected to the same index.html, but when I try http://path1.myserver.com/chat, chat is being treated as a path, giving me a 404 error.
I need to make sure that every pathname in the pattern *.myserver.com/*/.../* be served by the same index.html (like done in .htaccess).
Related
I've tried to add the item below in .htaccess(wamp64\bin\apache\apache2.4.37\conf) and enabled Use URL Rewriting in Joomla however when I try to type abc.com in search engine address bar it will still redirect me to search page instead of redirecting me to the website. I've also performed checking and confirmed that .htaccess file is readable, the webpage is work when go to https://www.abc.co m however redirection still not work. I just need the page to redirect from http://abc.co m to https://www.abc.co m Is there any other way to do it? Or I'm doing it wrongly?? Please help.
RewriteCond %{HTTP_HOST} ^abc.com [NC]
RewriteRule ^(.*)$ https://www.abc.co m/$1 [L,R=301]
The redirect itself works great. The issue is where you've put the file.
.htaccess files are meant to be in the root folder and sub-directories of your website, not in the config files for Apache. Think of them as configuration files the server will find on-the-fly as it serves up documents, not static configurations loaded when the server starts (which are found in the "conf" folder you referred to). (See https://httpd.apache.org/docs/current/howto/htaccess.html)
For WAMP, the root folder is typically a folder called "www" and is normally located at c:/wamp/www. See Where is the web server root directory in WAMP? More commonly, though, this folder is called "public_html" (such as with LAMP, XAMP, MAMP, or default Apache installs).
I am having a issue with the redirects of my URL using Microsoft Azure Web Service.
When I am executing www.myurl.com I am going to the correct page.
If I remove the www and execute myurl.com it redirects me to a incorrect page. The page that is shown, is only avaiable through a sub domain like login.myurl.com.
I am hosting on Microsoft Azure Server.
The root of the server basically contains the index.html on which the main page should redirect. However, without the www it redirect into a folder on root, and goes to the index.php inside that folder. There are more subfolders and it doesn't go into the alphabetic first one.
- www
-- index.html (this should be called)
-- // login folder
---- index.php (this is getting called without www)
after I uploaded an html file to the servers hosting my domain, for example a file named a.html uploaded to b.com, I need to type the url: b.com/a.html to see the contents of the file. But how can I have a website/content in b.com without any files? Meaning that when I search b.com I will see some content without adding "/a.html"
Rename a.html to index.html (or create a new file). Then take a look a b.com.
When a webserver is pointed to a directory, it will look for a file with index as prefix. So when visiting domain.com, you will see the contents of index.html.
I found this at https://httpd.apache.org/docs/trunk/getting-started.html
Typically, a document called index.html will be served when a directory is requested without a file name being specified. For example, if DocumentRoot is set to /var/www/html and a request is made for http://www.example.com/work/, the file /var/www/html/work/index.html will be served to the client.
I don't know if this counts as a redirect, but I need all url's that start with a to open up the index.html in their first directory. Meaning website.com/blog and website.com/blog/3 both use website.com/explore/.index.html file, while website.com/albums, website.com/albums/john-smith, and website.com/albums/john-smith/4 all use website.com/albulms/index.html
Is there anyway to make the index.html files load without changing the redirect of the url itself?
As my title says, using htaccess how can I specify index.html as the home page with both index.html and index.php on the server ? I have a regular basic html site on the server and I want to start working on a joomla site which of course uses php. I don't want to redirect the php if I enter in the index.php into the address to allow me to start working on the joomla installation. I just want to automatically go to index.html when the domain name is entered. I hope I'm making sense. Thanks
You use DirectoryIndex to specify, which file is shown, when just the directory is requested
DirectoryIndex index.html