Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 518
  • Last Modified:

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?
0
cano63
Asked:
cano63
  • 3
  • 3
1 Solution
 
vancleefCommented:
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.

0
 
cano63Author Commented:
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

0
 
vancleefCommented:
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...
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
cano63Author Commented:
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
0
 
vancleefCommented:
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.
0
 
cano63Author Commented:
I found the way to pass the correct url


RewriteCond %{QUERY_STRING} ^option=com_rsform&Itemid=8&lang=en$
RewriteRule ^index.php$ http://www.index.php

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now