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
Related
This website was in one server, and that server failed, so an automatic backup has made. the problem is that now it looks like a lot of files are missing, if I check the console in the browser there is a lot of 404 errors, and the requested URL is wrong.
Is there a kind of configuration file in which I can set the url that wordpress should use to request the files?
Update:
Only the .js, .css and .png files are wrong requested, the .php and .html files are fine.
It may be an issue with the trailing slash into the home URL and site URL. The URL should be "example.com". Add the slash in the last of the website URL.
Try with adding a trailing slash in the site URL and home URL.
I fixed it, the file I was searching for is wp-config.php, and the line that did the trick is
define('WP_SITEURL', 'http://example.com');
I don't know what was the problem, but I basically solved it overwriting that config variable.
So i have created a plugin that gets data from a API and creates posts. For example posts urls are similar to following structure .
https://sitesite.net/invite/username
About 100 posts are created this way and the only thing differs is the username. I want to redirect all
urls with /invite to a certain another url.
What is the best way to do this? Please consider that i'm new to wordpress.
So far i've tried some plugins like Redirection plugin and SEO Redirection Premium plugins. But i could not find a way to redirect all the urls with /invite in the url to another url. Both these plugins can set the source url and redirect to another url. But it's not practical for me as i have 100s of urls.
How can i redirect all my urls to another url .
The best way is to do it directly in your .htaccess file in the root folder of your Wordpress installation.
The following rewrite rule will redirect all pages in your invite folder to the same page in another folder called newfolder:
RewriteRule ^invite/(.*)$ /newfolder/$1 [R=302,NC,L]
Note the R=302 - make sure you use this for testing and only change it to a permanent 301 redirect when you are sure everything works!
(The .htaccess is not a Wordpress file, standard file on your web hosting. But if you’re not familiar with it, it’s a very important file to make your site work, so check back with us if you’re unsure of anything before you change it and always make a backup before ANY changes to it!!)
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.
I have a cakephp 3 script installed on my cpanel account.
this domain is the primary domain for account but i have relocated it to a subfolder for necessary reasons.
my htaccess rewrites it perfectly and every url works both with and without /subfolder/ in the url.
However, all the links in cakephp automatically append /subfolder/ back into the url.
I even tried manually replacing $base_url in configuration.php with 'mydomain.com'; only, but that didn't work. Then I replaced every instance in all the hundreds of files of $base_url with 'mydomain.com'; but still, nothing changed and it still shows that /subfolder/ in every url even when i access mydomain.com directly._
I need to get rid of this /subfolder/ in the url that cakephp is serving from php. i tried everything i knew but nothing works.
Please tell me how to solve this problem.
Have you tried setting App.base, App.webroot? Setting those values up will disable automatic directory detection and should help you get the URLs you want. See configuration docs for more on those values.
I am doing a redirection to a path. The php redirection using headers start at www.example.com and redirects to www.example.com/themes/mypage/login.php. I know htaccess can help create a shortcut url but that url has to be typed in. I have recently achieved this using htaccess but my css and scripts ain't working. How can i solve this?