henere
Goto Top

Frage zu Rewrite im Apachen

Umgebung Ubuntu 14.04. LTS
Server version: Apache/2.4.7 (Ubuntu)

Hallo zusammen,

auf meinen Webserver gibt es 2 Rewrite Rules. Kann es sein, dass eine davon die andere überschreibt ?

in der /etv/apache2/sites-available/seite.conf steht:

RewriteEngine on
        RewriteRule !^/.well-known/acme-challenge/ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=permanent]

in der .htaccess in /var/www/html/seite steht

RewriteEngine On
redirect 301 /forum.htm /xt-phpbb/
redirect 301 /dcforum /xt-phpbb/

RewriteRule ^dcforum/user_files/(.*) /xt-phpbb/files/$1 [R=301,L]
RewriteRule ^dcforum(.*) /xt-phpbb/ [R=301,L]

Ich brauche den Rewrite in der .conf wegen letsencrypt. Der funktioniert auch.

Aber wenn jemand https://www.xt-foren.de/dcforum/dcboard.php aufruft, dann wird nicht nach https://www.xt-foren.de/xt-phpbb umgeleitet.

Das Ganze hatte aber schon mal funktioniert.

Kann mir hier jemand den entscheidenden Tipp geben ?

Danke und Grüße, Henere

Content-Key: 309585

Url: https://administrator.de/contentid/309585

Printed on: April 18, 2024 at 07:04 o'clock

Mitglied: 129813
129813 Jul 12, 2016 updated at 09:21:31 (UTC)
Goto Top
Hi,
you are stopping the following rewrite process in the .conf with the L (Last) Option.

Regards
Member: Henere
Henere Jul 12, 2016 at 09:28:23 (UTC)
Goto Top
Hi highload.
So I just have to remove the "L" in the Files ?

Kind regarding, Henere
Mitglied: 129813
Solution 129813 Jul 12, 2016 updated at 09:30:06 (UTC)
Goto Top
Zitat von @Henere:
So I just have to remove the "L" in the Files ?
Only needed to remove it in the .conf not the .htaccess.
Member: Henere
Henere Jul 12, 2016 at 09:37:14 (UTC)
Goto Top
Done, actual in the .conf

RewriteEngine on
        RewriteRule !^/.well-known/acme-challenge/ https://%{HTTP_HOST}%{REQUEST_URI} [R=permanent]

But the redirect still does not work.

Cleared the squidcache und tested with 3 different browsers.

Is there another problem in my config or in the .htaccess ?

Each request containing a "dcforum" should be redirected to (https://www.xt-foren.de)/xt-phpbb)

TIA, Henere
Member: Henere
Henere Jul 12, 2016 at 09:45:26 (UTC)
Goto Top
Now i´ve added the code:

RedirectMatch 301 /dcforum(.*) /xt-phpbb/$1

to the .htaccess. But the redirect still does not work.
Is there any possibility to "defunct" the .htaccess ?

Henere
Mitglied: 129813
Solution 129813 Jul 12, 2016 updated at 09:53:03 (UTC)
Goto Top
Is there any possibility to "defunct" the .htaccess ?
Yes. Overriding should be enabled in the site config for this directory:
AllowOverride all
https://httpd.apache.org/docs/2.4/mod/core.html#allowoverride
Member: Henere
Henere Jul 12, 2016 at 09:52:42 (UTC)
Goto Top
Ok, got it.

AllowOverride was not set.

Thx Highload !

Now it works.
Mitglied: 129813
Solution 129813 Jul 12, 2016 at 09:53:49 (UTC)
Goto Top
You're welcome face-smile