Forum Moderators: phranque
Is anyone able to help please?
[edited by: jdMorgan at 3:29 pm (utc) on May 15, 2009]
[edit reason] Please use example.com only. See TOS. [/edit]
Somehow this forum messes up the delimiter between htm+html. Got to be a l of course ! ;)
[edited by: Nick_oTeane at 10:41 am (utc) on May 15, 2009]
[edited by: jdMorgan at 3:30 pm (utc) on May 15, 2009]
[edit reason] example.com [/edit]
RedirectMatch (.*)\.(htm¦html)$ [forum.angliki.info...] [R=301,L]
Is this gonna work?
RedirectMatch 301 (.*)\.(htm¦html)$ [forum.example.com...]
[edited by: jdMorgan at 3:30 pm (utc) on May 15, 2009]
[edit reason] example.com [/edit]
Any ideas?
[edited by: jdMorgan at 3:31 pm (utc) on May 15, 2009]
[edit reason] example.com [/edit]
You don't need two sets of parentheses anyway. Take advantage of the pwoer of regular expressions, and use
RedirectMatch 301 ^/(.+\.html?)$ http://forum.example.com/$1
If "forum.example.com" is *not* hosted in a separate filespace on this server, then this directive will cause a redirection loop, and you will have to use mod_rewrite instead of mod_alias to fix that problem.
Jim
[forum.example.com...]
The link it was redirected from is http://example.com/247.htm
Can you help?
[edited by: jdMorgan at 8:00 pm (utc) on May 15, 2009]
[edit reason] Use example.com only. [/edit]
Redirect 301 /portal.htm*here?* [forum.example.com...]
[edited by: Diablotik at 12:37 am (utc) on May 17, 2009]
What I read on this forum I think I should use RewriteRule instead of Redirect if this is a dynamic page.
So I think it should be similar to
RewriteRule ^/portal.htm$ http://www.example.com/$1 [L,NC]
but it does not work :(
I cannot find out how to rewrite the rest of the url which is after portal.htm to new url as this is probably the reason why this does not work.
[edited by: Diablotik at 1:02 am (utc) on May 17, 2009]
If it is a query string, then you'll have to use a RewriteCond if you want to change that query string. If you want to pass the query string through, then no additional code is needed, as this is the default behaviour.
However, note that the pattern is different between Redirect and RewriteRule in .htaccess :
RewriteRule [b]^po[/b]rtal\.htm$ http://www.example.com/ [NC,R=301,L]
[edited by: jdMorgan at 1:55 am (utc) on May 17, 2009]
If you write a rule like
RewriteRule ^abc$ /def [L] If you write a rule like
RewriteRule ^abc$ /de[b]f?[/b] [L] If you write a rule like
RewriteRule ^abc$ /def[b]?new-query=value[/b] [L] If you write a rule like
RewriteRule ^abc$ /def?additional-query-parameter=value [[b]QSA,[/b]L] If you want to test a query string, then you must use a RewriteCond:
# Replace old query, keep same "page" URL
RewriteCond %{QUERY_STRING} ^old-query=old-value$
RewriteRule ^abc$ /abc?new-query=new-value [L]
RewriteCond %{HTTP_HOST} ^forum\.example\.com
RewriteRule ^portal\.php$ http://example.com/portal.php [R=301,L]
Jim
[edited by: jdMorgan at 12:28 am (utc) on May 23, 2009]