I have this url to access a study within the web:
http://miweb.com/index.php?option=com_component&view=estudio&factura=1&id=25977&token=8f8c54a3ce165332fd59f17
I want a URL similar to the following to redirect to the previous one
http://miweb.com/estudio&factura=1&id=25977&token=8f8c54a3ce165332fd59f17
That is, replace part of the URL, but keep the rest of the parameters.
So far, I've edited mod_rewrite in the .htaccess file and got it to replace strings (for example com_component
), but not string index.php?option=com_component&view=estudio
. This gives me an error, is it because of the ?&=
?
RewriteEngine On
Rewritebase /
<IfModule mod_rewrite.c>
RewriteCond %{QUERY_STRING} (.*)com_component(.*) [NC]
RewriteRule (.*) $1?%1nuevostring%2 [R=302,L]
</IfModule>
How can I replace the entire line index.php?option=com_component&view=estudio
with one word (eg "study")?
edit:
Is it possible that the URL with all the parameters is served in the URL, but the part does not appear index.php?option=com_component&view=estudio
? I don't want the user to see the name of option and view, but instead they are parameters that I need for the URL to work
First of all, notice that you have an error in the URL. Parameters always start with
?
and are separated by&
. The URL that the end user will access will be:What you're looking for is a rewrite (not redirect), which involves taking a URL and serving a different resource (rewrite), but without modifying the client's URL (no redirect), transparently to the client.
In other words, we would have the redirection that is already in your rules to modify a parameter, and we would add this rewrite to it:
Thus, when the client accesses:
Apache serves you this URL (transparently):