Redirect – Multisite HTAccess redirection does not work

I have a multi-site Drupal 8 setup with .htaccess file in the configuration directory. I also have a .htaccess file in the root directory. (I think this is the default, but if there is no .htaccess file in the configuration directory, there is an error on the status page.)

I would like to redirect to include URLs / – / will be forwarded without a URL.

So far I have tried the following.

  RewriteEngine on
  RewriteCond %{REQUEST_URI} ^/-/(.*)? (NC)
  RewriteRule ^(.*)$ %1

I have tested it with and it looks fine, but the redirect will not be done.

Could someone point me in the right direction?

htaccess – Migration von Magento 1.9.x auf VPS-Fehler 403

Ich muss die Site in Magento, mehrsprachig, von Shared Hosting auf VPS migrieren. Beim Shared Hosting verwende ich cPanel, beim VPS verwende ich Plesk.
Nach einem erfolgreichen Übertragungsversuch ist mir ein Fehler aufgefallen.

Ich erkläre, dass ich im Stammverzeichnis der Site Ordner mit dem Namen des Sprachcodes der Site erstellt habe, in denen sich bis auf die sitemap.xml der Site mit dieser Struktur Folgendes befindet:


Mit cPanel habe ich keine Probleme. Wenn ich stattdessen auf dem Server und dem Plesk auf die Startseite der Site oder auf das Logo klicke, wird der Fehler 403 angezeigt. Durch Umbenennen der Ordner verschwindet der Fehler.

Ich möchte diesen Fehler beseitigen, und zwar die Ordner "en" und "it" behalten Dort speichere ich die Sitemaps, die an die Suchkonsole gesendet werden sollen.

Wie kann ich das lösen?

Vielen Dank

8 – .htaccess rewrite does not work

I have a custom module with a page under /page what to expect $_GET('id') to do it, it is work.

Here is .htaccess Rewrite rule that works when the website is empty

RewriteRule category+/(.*)$ page.php?id=$1 (L)

That should be the case on Drupal 8

RewriteRule category+/(.*)$ page?id=$1 (L)

but it gives me 404 mistakes when I visit /category/5

.htaccess = make .php files looks like .aspx

I have a PHP script and I do not want visitors to see that PHP is being made

so insteand of visitors you will see this link I want them to see it

It will be the same content, but only for visitors who want to work with new extensions .aspx (FILE.aspx does not exist)

# Change .php extension to .aspx
RewriteCond %{THE_REQUEST} (.*).aspx  
RewriteRule ^(.*).php $1.aspx (PT)  

I tried it, but it does not work, this is not a duplicate post as well, since I checked all the other posts and did not find the answer

htaccess – prevents canonical redirect only for the staging domain (pre-production domain)

We have a single WordPress instance that can be accessed in two different domains: and,

The first is the canonical site, but the second should also be accessible. The problem is that WordPress automatically makes a 301 redirect to the Canonical Site.

This redirection is fine in most cases, so I do not want to completely disable it, but only prevent it in that particular domain, preferably without touching too much code.

Is it possible to use that? .htaccess File to modify the request that causes WordPress to view it as coming from the canonical side (preventing the redirect)? I think it may have the least impact, but is there perhaps a better alternative?

.htaccess – Prevents direct access to images

I want to prevent access to images. This means you can not access or

But what if it can be accessed with calls from the website code. For that I tried different things, which I looked for the answer, but nothing worked for me. I think the correct thing is to add the following in htaccess:

RewriteEngine on 
RewriteCond %{HTTP_REFERER} ^$
RewriteCond %{HTTP_REFERER} !^https://(www.)? (NC) 
RewriteCond %{HTTP_REFERER} !^https://(www.)?*$ (NC) 
RewriteRule .(jpeg|jpg)$ - (F)

I've tried using https and http, but in any case, I can still access the images as if I had not stated anything. This htaccess is in the root directory, although I have already tried to include this part in an htaccess file in the photo directory.

Thank you in advance for the help, because I think I am very lost.

.htaccess – How do I remove custom post types from the WordPress URL?

I have a WordPress site that uses the custom template with custom post types like Landing and Services.

Each post type has a specific slug in the URL like this => (

I'd like to change this URL ( to this URL (

In fact, I have to remove the phrase from the URL. The important thing is that this is a custom post type in my post table.

I have tested the following solutions:

==> I have slug in the property rewrite in register_post_type () on & # 39; / & # 39; changed. -> It cancels all landings, posts, and page URLs (404).

==> I have & # 39; with_front & # 39; added => false to property rewrite -> nothing changed

==> I tried doing this with RewriteRule in htaccess -> it did not work or there were too many redirect errors

I could not get a real result.

Has anyone ever solved this problem?

.htaccess – Advanced Redirect 301 htaccess

I need access to this through redirection 301:

Of these:


I tried that:

Redirect 301 /post-noticia/octubre-2019/

But the result is:

I need to be the result:

That is, omit: 122-


Why is my .htaccess file not redirecting my old WordPress permalink structure?

# BEGIN WordPress

RewriteEngine On
RewriteBase /

# Additional rewrite rules go here
RewriteRule ^(0-9){4}/(0-9){2}/(.*)$ /$1 (R=301,L)

All custom mod_rewrite directives, such as For example, your "redirect" should be in front of it # BEGIN WordPress Section. You should avoid editing yourself as a WP between the WordPress comment markers tries to preserve this section and possibly overwrite your custom changes during a future update, unless you take additional steps to avoid this (such as restricting file permissions, etc.).

AsideIn the blog article you linked, it was suggested to place the "additional transcription rule" in the middle of the rule block. If this were not a WordPress site, this might be the right (most logical) place to place it. However, this is WordPress, so there are other limitations (as mentioned above).

You can literally just move this one line before the # BEGIN WordPress Line. The Wrapper and RewriteEngine Policies do not need to be repeated. For example

# Additional rewrite rules go here
RewriteRule ^(0-9){4}/(0-9){2}/(.*)$ /$1 (R=301,L)

# BEGIN WordPress

RewriteEngine On
RewriteBase / 

You may also consider redirecting to and including your canonical URL (hostname + HTTPS) at the same time In front Your HTTP to HTTPS redirect. This would avoid a potential duplicate redirection when requesting HTTP and your old permalink structure. For example:

RewriteRule ^d{4}/d{2}/(.*)$1 (R=301,L)

(Although you do not seem to canonize the hostname at this time?)

A note about RewriteEngine… while it is common to see multiple instances of this policy on the Internet .htaccess File (usually if the application itself manages the code or if code is copied / pasted), only the very last instance of this statement in the .htaccess File has no effect. So, from the perspective of coding, with several RewriteEngine Guidelines are completely redundant and confusing. e.g. frame RewriteEngine Off earlier in the file does nothing. The same applies to RewriteBase – Only the last instance in the file does something.

For checking , see this other question: