21309 Posts in 5738 Topics by 2603 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 896 Views |
-
Custom htaccess redirect

5 May 2009 at 2:59am
Hello everybody
I've got one question.
Is there any possibility, to rewrite some SS URL adress in .htaccess file, from one to another?
I've just want to add custom rule to htaccess without processing URL it with controller.
For example:
I've got URL like:www.mysite.com/realize?choice=b2b&s=name
where "realize" is SS URL, with some $_GET values, i'm working with. It works great.
But:
I'm trying to change this URL to something like this:
www.mysite.com/object-spa/hotelsI was trying add simple rule like:
RewriteCond %{HTTP_HOST} ^www.mysite.com/object-spa/hotels$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/realize?choice=b2b&s=name[L,R=301]
before line with patch to controller:
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
But it didn't work.I've also red some about Director class , and there was information, that i could add some rule into config.php file, but honestly, i didn't understand this doc well, and still don't know , how it exactly works.
Is anybody know, how could i solve this issue? I'm new with SS, and i'm still learning, so i will appreciate any replies .
Thanks
Przemek -
Re: Custom htaccess redirect

5 May 2009 at 8:02pm
Ok, let me ask something easier
Suppose, i've got some external script, i want to mergre with SS application
It is in main SS catalogue.What do i need to do in htaccess file , to see link like that:
not like that:
www.mysite.com/script_file.phpIt's seems, every rule, 'i've added, was overrided by that line
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L] -
Re: Custom htaccess redirect

7 May 2009 at 6:17am
Well, your condition will never match, since your HTTP_HOST will not contain the whole url! You should use REQUEST_URI, like so:
RewriteCond %{REQUEST_URI} object-spa/hotels$ [NC]
RewriteRule ^(.*)$ http://www.mysite.com/realize?choice=b2b&s=name[L,R=301]For your second question, you could do something like this (additional code highlighted):
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule script_file/?$ script_file.php [NC,L]
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
| 896 Views | ||
|
Page:
1
|
Go to Top |


