New answers tagged

2 votes
Accepted

Alternate page with proper canonical tag - htaccess rule

RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L] There's nothing wrong with this rule. (Although it's not complete by itself. I assume there must be a RewriteCond directive that precedes this ...
  • 42.2k
5 votes
Accepted

RewriteRule started returning 403 Forbidden error

For some reason, without me making any changes, those pages have started returning a 403 Forbidden error. It's likely the version of Apache has been updated on your server. I answered a similar ...
  • 42.2k
0 votes
Accepted

Remove sub folder name from URL

To permanently "remove" the /portal prefix from the stated URL, you could do something like the following in the root .htaccess file using mod_rewrite: RewriteEngine On # Remove "/...
  • 42.2k
1 vote

Is it possible to restrict the access to a website with a login/pwd tuple without having access to the Apache config?

This is dependent on how the webserver is set up. From your comments it seems that the web server is not Apache or that .htaccess access is restricted when in the website root directory. It is ...
  • 6,761
2 votes

Is it possible to restrict the access to a website with a login/pwd tuple without having access to the Apache config?

The path for the password file has to be based on your user home directory, not the website url. So something like this (assuming that your website folder is called public_html. AuthName "...
  • 1,254
1 vote
Accepted

How can I redirect a PDF to home page?

RewriteEngine On RewriteRule ^ brochure.pdf$ https://example.com/[R=301,L,NC] This is basically correct, except you have made (what looks like) a series of typos with the spacing/whitespace: Each ...
  • 42.2k

Top 50 recent answers are included