Link to home
Start Free TrialLog in
Avatar of cano63
cano63

asked on

Apache RewriteRULE

Hi People,

I Have a RewriteRule in my apache vhost-ssl.conf file to move the site to some areas that are https and other http.
The problem here is that if i use a regular adress like this /test/house.html it works fine, but when i use a url that have special caracters like this: index.php?option=com_rs&Itemid=34&lang=en, the rule seems not to be understanding my url and don't apply the rule.

I think that the synxtax for this kind of url is diferent: i already try this and won,t work
/index\.php?option=com_rs\&Itemid=34&lang=es

Does some one know the rules?
Avatar of vancleef
vancleef
Flag of United States of America image

Is this any help? It talks about using rewrite on a CMS system.
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

You might have to give some examples of what you are trying to do, to help us understand the exact problem.

Avatar of cano63
cano63

ASKER

This is the rule that i,m using, the problem here is that the system don,t understand this url

index.php?option=com_rsform&Itemid=8&lang=en

if i use a simple url it work fine, something like this /test/test.html

this is why i think that i,m missing something in the syntax.
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule !^(index.php?option=com_rsform&Itemid=2&lang) http://%{HTTP_HOST}%{REQUEST_URI} 
 
 
</VirtualHost> 

<Virtualhost *:80>
  

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(index.php?option=com_rsform&Itemid=2&lang) https://%{HTTP_HOST}%{REQUEST_URI} 

</VirtualHost>

Open in new window

Hmmm.... The example given on the link was;
 
RewriteRule ^products/([0-9]+)$  /products/$1/ [R]
I haven't played with this for awhile, but I would experiment with something along the line of;

RewriteRule
^index.php?option=com_rsform&Itemid=[0-2]&lang=en$  
http://index.php?option=com_rsform&Itemid=$1&lang=en
The second line is trying to capture the part that changes, while the third line is attempting to build the desired line from the captured information.

Hopefully that makes sense...
Avatar of cano63

ASKER

As i can see the number have to go inside []
I try with the $ at the end of the url and the ^ at the begining but don,t work i,m going to try it with the numbers inside the []

I let you know
the ^ and $ are only used on the first regular expression to indicate its beginning and end, with the values in [] captured as variables.  The transferred values are passed as arguments... $1, $2, etc.

Here is another example with two separate values being captured and passed on;
RewriteRule
^([a-z]+)/([a-z\-]+)$
/$1/$2.php [L]

It is from this tutorial:
I'm splitting the examples across multiple lines simply to make them easier to read on this forum.
ASKER CERTIFIED SOLUTION
Avatar of cano63
cano63

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial