Url without www redirect to different page - azure

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)

Related

How to redirect non www to www for prod website

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).

301 redirect from all pages to main page, without wp-admin directory

i need to redirect all pages from my site to main page, and my admin directory must work. For example, page: http://novaya-sergeevka.ru/1, have to redirect to http://novaya-sergeevka.ru/ and the directory /wp-admin/ must work. Thanks

Redirect IIS's root to application root

I have several applications installed on IIS:
/abc
/bcd
Now I want to redirect users coming to / to the /abc website. Since the root is not part of any application, I cannot use IIS Rewrite Module which uses redirects defined in web.config.
So I installed HTTP Redirection in IIS and enabled the following:
This works, if the user enters exactly http://example.com or http://example.com/, the server redirects to http://example.com/abc/.
However, if the user enters http://example.com/abc, the server treats the request as in the root directory, so it applies a redirection too, leading to http://example.com/abc/abc.
I also tried checking the first checkbox (Redirect all request to exact destination), but this leads to a redirection loop from http://example.com/abc to http://example.com/abc.
I want those users entering example.com/abc to stay there, and redirect users entering example.com to the /abc application. How can I do that?
To fix the redirect loop, you can add a trailing anchor link to the destination, for example: /abc/#. This prevents IIS from stripping the trailing slash and creating a redirect loop from http://example.com/abc to http://example.com/abc
Example redirect
Request URL:https://example.com/abc
Request Method:GET
Status Code:302 Redirect
Response Headers
Location:https://example.com/abc/#
Server:Microsoft-IIS/8.0
Request URL:https://example.com/abc/
Request Method:GET
Status Code:200 OK
URL rewrite module
Alternatively you can still use the URL rewrite module as discussed here even when it is for your root site and not an application. The web.config file should be present in your web root folder (typically %SystemDrive%\inetpub\wwwroot). You can also use the URL Rewrite UI in IIS Manager to add an inbound rule:
This will redirect http://example.com/ to http://example.com/abc/.
If the user enters http://example.com/xyz (and that file does not exist) they will not be redirected to /abc and will receive a 404, unlike the HTTP redirect module above.

using htaccess how can I specify index.html as the home page with both index.html and index.php on the server?

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

Redirecting bad url links from external sites with .htaccess

I have two inbound links that land on 404 pages because the links are squiffy. I have tried 301'ing these links as normal but without success, I believe because of the characters used from this external URL.
Column<u>Radiators.html
is the page suggested on this external site and
Column_Radiators.html
is the actual page.
also
Bath%3Cu%3EFiller.html
on the external site and
Bath_Filler.html
on our actual website.
How can I succesfully redirect these pages?
Simply add these lines in your .htaccess
redirect 301 /Column<u>Radiators.html /index.html
redirect 301 /Bath<u>Filler.html /index.html
Note: I use index.html as the default redirection but you can use a custom 404.

Resources