Discussion:
[TYPO3] RealURL and .htaccess
Alexander
2007-08-02 06:01:09 UTC
Permalink
Hello list.
I have some problems with RealURL configuration and redirections. I need
place some redirects into my .htaccess file, but now RealURL has
priority. How can I do this, I mean how to make priority for .htaccess.
I need to read .htaccess settings first then RealURL settings.

Regards, Alex
Jan Bednarik
2007-08-02 06:46:15 UTC
Permalink
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I need
place some redirects into my .htaccess file, but now RealURL has
priority. How can I do this, I mean how to make priority for .htaccess.
I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
--
Jan Bednarik
www.bednarik.org - web about Typo3 in czech
Alexander
2007-08-02 06:55:21 UTC
Permalink
Post by Jan Bednarik
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL has
priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
Thanks for quick answer. I will try it.
Alexander
2007-08-02 11:29:38 UTC
Permalink
Post by Alexander
Post by Jan Bednarik
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL
has priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
Thanks for quick answer. I will try it.
Seems like this advice doesn't works.
There is my .htaccess configuration:

[code]
Options +FollowSymLinks
RewriteEngine On

RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html


RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,QSA]


RewriteRule
^(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico)/
- [L]
RewriteRule ^typo3$ typo3/index_re.php [L]


RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l


RewriteRule .* index.php [L]

[/code]

Is this right configuration?
Jean-François Gingras
2007-08-02 11:49:58 UTC
Permalink
I never used the Rewrite engine but your RedirectMatch directive is wrong.

You need to escape the '.' (dot) in your regex is you want it to mean
'.' (dot) and not 'any character'.

Jean-Fran?ois Gingras
Webmestre
Service des t?l?communication et des technologie de l'information
C?gep de Sainte-Foy
T?l.: (418) 659-6600 #3825
Post by Alexander
Post by Alexander
Post by Jan Bednarik
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL
has priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
Thanks for quick answer. I will try it.
Seems like this advice doesn't works.
[code]
Options +FollowSymLinks
RewriteEngine On
RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,QSA]
RewriteRule
^(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico)/
- [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
[/code]
Is this right configuration?
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
Alexander
2007-08-02 11:55:31 UTC
Permalink
Post by Jean-François Gingras
I never used the Rewrite engine but your RedirectMatch directive is wrong.
You need to escape the '.' (dot) in your regex is you want it to mean
'.' (dot) and not 'any character'.
How can I do this?
Post by Jean-François Gingras
Jean-Fran?ois Gingras
Webmestre
Service des t?l?communication et des technologie de l'information
C?gep de Sainte-Foy
T?l.: (418) 659-6600 #3825
Post by Alexander
Post by Alexander
Post by Jan Bednarik
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL
has priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
Thanks for quick answer. I will try it.
Seems like this advice doesn't works.
[code]
Options +FollowSymLinks
RewriteEngine On
RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,QSA]
RewriteRule
^(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico)/
- [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
[/code]
Is this right configuration?
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
Jean-François Gingras
2007-08-02 12:08:31 UTC
Permalink
Simply put un '\' (backslash) in front of it, like this:

\.

Plus, not sure if RedirectMatch is case sensitive, but you might want to
add '(?i)' at the begining of your regex to use case insensitive match:


(?i)^/productsIndList\.aspx?nodeID=2357$

The '?' character is also a special character and mean 'match zero or
one of the previous charater'. So you should probably escape it as well,
like this:

\?

So, in the end, we get the following regex:

(?i)^/productsIndList\.aspx\?nodeID=2357$

Not sure if it will work, but does hurt to try!

Cheers
Post by Alexander
Post by Jean-François Gingras
I never used the Rewrite engine but your RedirectMatch directive is wrong.
You need to escape the '.' (dot) in your regex is you want it to mean
'.' (dot) and not 'any character'.
How can I do this?
Post by Jean-François Gingras
Jean-Fran?ois Gingras
Webmestre
Service des t?l?communication et des technologie de l'information
C?gep de Sainte-Foy
T?l.: (418) 659-6600 #3825
Post by Alexander
Post by Alexander
Post by Jan Bednarik
Hey,
Post by Alexander
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL
has priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
.htaccess is always first. RealURL comes when request is redirected to
index.php. That means you need to place your rules before rules that
redirect everything to index.php.
Thanks for quick answer. I will try it.
Seems like this advice doesn't works.
[code]
Options +FollowSymLinks
RewriteEngine On
RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html
RewriteCond %{HTTP_HOST} ^domain\.com$
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L,QSA]
RewriteRule
^(typo3|t3lib|tslib|fileadmin|typo3conf|typo3temp|uploads|showpic\.php|favicon\.ico)/
- [L]
RewriteRule ^typo3$ typo3/index_re.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule .* index.php [L]
[/code]
Is this right configuration?
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
_______________________________________________
TYPO3-english mailing list
TYPO3-english at lists.netfielders.de
http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-english
Jan Bednarik
2007-08-02 12:26:42 UTC
Permalink
Post by Alexander
RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html
I'm not good in mod rewrite (that's why I created CoolURI), but I guess
you need to add [L] so it'd stop processing next rules:

RedirectMatch Permanent ^/productsIndList.aspx?nodeID=2357$
http://www.domain.com/products/business/categories/30.html [L]
--
Jan Bednarik
www.bednarik.org - web about Typo3 in czech
Oliver Rowlands
2007-08-02 14:16:54 UTC
Permalink
Hi Alexander,

You can not target the query string with Apache's mod_alias Redirect and
RedirectMatch directives.

You will have to use mod_rewrite instead:

RewriteCond %{QUERY_STRING} nodeID=2357 [NC]
RewriteRule ^productsIndList\.aspx$ http://domain.com/page.html?
[NC,R=301,L]

A few explanations:
- The NC flag means the match is case insensitive;
- The R=301 flag forces a permanent redirect (HTTP 1/x 301 Moved
permanently) which is important if you care about your SEO;
- The L flag stops the rewriting process without applying any other rules;
- The '?' at the end of the redirection URI prevents mod_rewrite from
automatically appending the GET parameters from the old URI.

If you need to redirect more than just a few URIs you might want to
consider using a redirect map instead. I wrote this HOWTO a few of
months ago which explains the process:

http://lists.netfielders.de/pipermail/typo3-english/2007-May/039509.html

BTW: Jan, the [L] flag only applies to mod_rewrite directives not mod_alias.

Hope this helps,

Oliver
Post by Alexander
Hello list.
I have some problems with RealURL configuration and redirections. I need
place some redirects into my .htaccess file, but now RealURL has
priority. How can I do this, I mean how to make priority for .htaccess.
I need to read .htaccess settings first then RealURL settings.
Regards, Alex
--
Oliver Rowlands
:: Liquid Light ::

E - oliver at liquidlight.co.uk
W - http://www.liquidlight.co.uk

T - 00 44 (0)845 6 58 88 35
F - 00 44 (0)845 6 58 44 35
Alexander
2007-08-02 17:51:16 UTC
Permalink
OLIVER!!!
YOU'RE SAVED MY LIFE RIGHT NOW!!

all works perfect!!!

Regards, Alex.
Post by Oliver Rowlands
Hi Alexander,
You can not target the query string with Apache's mod_alias Redirect and
RedirectMatch directives.
RewriteCond %{QUERY_STRING} nodeID=2357 [NC]
RewriteRule ^productsIndList\.aspx$ http://domain.com/page.html?
[NC,R=301,L]
- The NC flag means the match is case insensitive;
- The R=301 flag forces a permanent redirect (HTTP 1/x 301 Moved
permanently) which is important if you care about your SEO;
- The L flag stops the rewriting process without applying any other rules;
- The '?' at the end of the redirection URI prevents mod_rewrite from
automatically appending the GET parameters from the old URI.
If you need to redirect more than just a few URIs you might want to
consider using a redirect map instead. I wrote this HOWTO a few of
http://lists.netfielders.de/pipermail/typo3-english/2007-May/039509.html
BTW: Jan, the [L] flag only applies to mod_rewrite directives not mod_alias.
Hope this helps,
Oliver
Post by Alexander
Hello list.
I have some problems with RealURL configuration and redirections. I
need place some redirects into my .htaccess file, but now RealURL has
priority. How can I do this, I mean how to make priority for
.htaccess. I need to read .htaccess settings first then RealURL settings.
Regards, Alex
Loading...