I have this URL in some of the sections of my website in Joomla:
http://miweb.com/index.php?option=com_component&view=contracts&ff=1&id=20977&token=8f8c54a3ce165332fd59f17319ba
The point is that I don't want users to see the name: com_component
when they access from the link. I need to replace it with another string
com_component
--> com_nuevonombre
I have edited the .htaccess file, activating mod rewrite and I have this:
RewriteCond %{QUERY_STRING} ^(.*)com_component(.*)$
RewriteRule ^(.*) $1?%1com_newname%2 [R=301,L]
I have almost achieved what I want, it replaces the string, but the error I have is that it adds the local path to my project in front of it. How can I correct it? I also accept other solutions if they occur to you.
The url that shows me after the error is something like this:
http://miweb.com/var/www/html/miweb/index.php?option=com_nuevonombre&view=contracts&ff=1&id=20977&token=8f8c54a3ce165332fd59f17319ba
Make sure you have the Document Root configured correctly in your
httpd.conf
.Restart Apache so that it takes the configuration.
In your .htaccess, add these 2 lines before the rules (normally not needed, but it works in cases where Apache can't determine the folder it's in):
Also, never use a 301 redirect until you've tested it and are absolutely sure it works fine. 301 redirects are heavily cached. You should try with:
and modify it to a 301 when there is no error, and you are sure that it will not be modified in the future.