Hi,
I'm trying to use the linux sed command to append a path element to the RewriteBase in a .htaccess file.
I have tried it with this arguments:
#current RewriteBase is "RewriteBase /mypath"
sed -ie 's/RewriteBase\(.*\)/RewriteBase \1\/add/g' .htaccess
with this result:
addriteBase /mypath
So sed overwrites the the beginning of the replacement string with the last string.
Why is that?
Another question would be how to prevent to have 2 slashes when the RewriteBase is just "/".
RewriteBase /
will become
RewriteBase //add
but should be
RewriteBase /add
Is there any way to prevent this? If not I can run a second sed command replacing all double slashes with a single one. But maybe there is a more elegant way to do this.
I would appreciate any help.