: How can I get a regular expression to only match an empty string? (In a .htaccess file) I try to make a regular expression in a .htaccess file, that matches only an empty string. I have
I try to make a regular expression in a .htaccess file, that matches only an empty string.
I have tried many things, but it seems like it’s impossible. For example, I tried ^$, but it's looking for "" that will always exist in a string.
So I seek answers to it all possible.
If possible, I would like to hear how to extend such a regular expression together.
Here is the content of my .htaccess file:
RewriteEngine On
RewriteRule ^$ stald-mariendal.dk/index_tekst [R=302,L]
RewriteRule ^guestbook.html$ stald-mariendal.dk/gaestebog [R=301,L,NE]
RewriteRule ^sites/guestbook.html$ stald-mariendal.dk/gaestebog [R=301,L,NE]
RewriteRule ^guestbook$ stald-mariendal.dk/gaestebog [R=301,L,NE]
RewriteRule ^(w+).html$ stald-mariendal.dk/ [R=301,L,NE]
RewriteRule ^sites/(w+).html$ stald-mariendal.dk/ [R=301,L,NE]
RewriteCond %{HTTPS} on
RewriteRule ^(w+)$ ?site=.html [L]
RewriteCond %{HTTPS}| off
RewriteRule (.*) stald-mariendal.dk%{REQUEST_URI} [R=301,L,NE]
More posts by @Carla537
1 Comments
Sorted by latest first Latest Oldest Best
I wasn't convinced this would work, but I've tested it and it does seem to.
Quite simply:
^.{0}$
Where:
^ is the start of the match
. is any character (except newline)
{0} is precisely zero times
$ is the end of the match
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.