Site redirects to index.php without www - php

I am trying to verify my SSL certificate for my website.
So I did upload a file to my server but when I try to access the file it is only working when i enter the url with www when I do it without www it redirects me to the index of my wordpress page.
Here is the url which redirects to index.php without the www
http://vanloonautobedrijf.nl/.well-known/pki-validation/3619BF0D6B387464A49478D183780BF0.txt
I did empty my htaccess file and still cant reach it without www

You have a redirection (301) configured somewhere which redirects all non-www requests to the same URL (see attached screenshot). In your case, it's not what you need, because the path info + query string is lost during that redirection.
When you find where is your redirection defined, try fixing it by setting the option to keep the path/query from the original URLs. The exact method to achieve this is specific to the way the redirection was implemented.
If you find where your redirection was configured, update your question and we might be able to help you fix it.

Related

Wordpress URL rewrites on NGINX server (without htaccess)

I've recently learned that I'm unable to use the .htaccess file to redirect and rewrite url's on an NGINX server. I'm in the process of migrating a 20,000 page .html website to wordpress, and must preserve the permalink structure and add redirects to maintain the SEO.
All I am trying to accomplish are two things:
Add a 301 redirect to .html pages that will point them to their .php counterparts
Remove the '/public_html/' folder from the page URL
www.website.com/public_html/[affiliate] => www.website.com/[affiliate]
I have been able to implement the 301 redirects via plugin for now, however I'm unsure how to go about removing the folder from the URL. I could place the affiliate folders in the root directory and not have to do this, but it will clutter up my workspace immensely.
This is my current attempt at rewriting the url (in site.conf.hbs --- is this the correct file?)
#
# Rewrite public_html out of url when visiting affiliate pages
#
location /public_html
{
rewrite ^(/public_html/.*)/(\w+).php /$2.php last;
}
Any help is much appreciated! The php redirect is working via plugin for now, but I'd like to just add it as a rule to get rid of the plugin if possible.
Thanks!

Redirect if someone add / to the url

i just wanted to know that how to remove more than one / from url from htaccess forex:-
This is the original url
http://example.com/folder/page.php
What if someone add another slash to folder like this
http://example.com/folder//page.php
It still showing page content but without any css and script. And how to prevent from adding /\ and redirect to the original url.
I am seeing this in most of the websites they redirect but my website is not redirecting.
I don't know it's a server issue or programmers issue. I contacted my hosting manager they are saying it's a programmers issue.
Can you please help me out with this
How to prevent from this and redirect using htaccess

How to properly redirect all files inside directory with .htaccess?

I have basically two questions.
How do I redirect domain.com/ipc/ to domain.com/category/indexpage/? Also, what happens to http or https version and www or non www version? Are they all redirected without any problem?
Let's say I want to also redirect domain.com/ipc/page to domain.com/category/indexpage/page? I mean are all webpages inside the directory redirected properly? Is it also possible with .htaccess redirection?
Thanks.
You can use mod_alias for a simple redirect inside your .htaccess file.
RedirectMatch 301 ^/ipc/(.*)$ /category/indexpage/$1
Also this has no baring on whether it was called with http(s) or www/non www. It just handles the redirect regardless.

How to reset htaccess redirects?

I was attempting to make the root of a directory redirect to a folder within it. (Eg. http://host.com/folderA/ redirect to http://host.com/folderA/folderB/
After various attempts of doing this, I kind of broke it..
The folder now redirects to the web root (http://host.com/)
And now I can't get the folder back to normal, no matter what I try.. it just keeps redirecting back to the web root. I tried adding a blank htaccess file and tried redirecting it to other folders but it remains redirecting to the root.
I no longer want it to redirect at all because I now just want to link to the folder from an index page. Is there any method of resetting redirects for this folder?

Url rewriting, xyz.com/questions has to redirect to somequestions.com/questions, via .htaccess

I am PHP developer recently got into Drupal development. But I am novice to URL redirecting etc issues. My issue is, I have a website already like xyz.com running on a hosting server. Recently I developed another site, which should be displayed as a subdomain like when user types xyz.com/questions automatically it has to redirected to somequestions.com/questions.
I searched the web and found some results and found that it is URL rewriting but I am unable to set it.
EDIT 1
How to mask the url with the initial URL that I have given. i.e., after entering xyz.com/questions it has to redirect the somequestions.com/questions but URL in the address must remain same.
I presume you need 301 redirection i.e Moved Permanently.
Add following line in your .htaccess file under xyz.com root directory:
Redirect 301 /questions http://184.133.111.012/questions

Categories