没有http | https的外部链接失败

I'm not very good at regular expressions at all.

the RewriteRule I use is:

 RewriteRule ^([a-zA-Z0-9_-]+)$ /kurum.php?sef=$1 [QSA]

Which converts

http://fxrehber.com/kurum.php?sef=gcm-forex to http://fxrehber.com/gcm-forex

my php file handles the URLs as :

<a href="http://<?php echo $demoUrl ?>" target="_blank">Open Demo Account</a>

If I don't include "http://" in my php file the links goes to

http://fxrehber.com/www.example.com

So I keep the URLs in the database as : www.example.com

But now I need to use URLs with https and I need to remove "http://" from the php file and I might be able to save the URLs in the database as both www.example.com and https://www.example.com

What's the way to do this? Changing my RewriteRule or modifying my php file with some regex?

Ok I was so concerned about the regex and RewriteRule so while explaining my problem I understood it can simply be solved by checking if the URL has http/https in it:

if (0 !== stripos($demoUrl, 'http://') && 0 !== stripos($demoUrl, 'https://')) 
{ $demoUrl = 'http://' . $demoUrl; }

Now I can save all 3 types of URLs (starting with www, http and https)in the database and don't need to modify the old ones. But I still wonder if there's a way to use links without http/https by a rewriterule. (as I stated before, when I click a link "www.example.com" in my site, it tries to go www.mysite.com/www.example.com)

Your regular expression in rewrite rule is for enabling clean URL. The mechanism is passing entire URI to kurum.php - via $_GET['sef'], where content routing should happen.

The following rules will disable rewrite if there actually is matching file/directory with the requesting URI.

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^([a-zA-Z0-9_-]+)$ /kurum.php?sef=$1 [QSA]