Forum Moderators: phranque

Message Too Old, No Replies

rewrite dynamic url to www.domain.com - how?

dynamic url to domain

         

kishkush

9:38 am on Feb 16, 2007 (gmt 0)

10+ Year Member



hello
i'm breaking my head on this for a second day and the task seems to be very simple:

how can i redirect this "/component/option,com_frontpage/Itemid,1/" to www.domain.com

so when someone click on url containing this string "/component/option,com_frontpage/Itemid,1/" he will be redirected back to domain itself ie. "www.domain.com"
but the redirection should work only from this specific string in url.
thanks in advance

jdMorgan

3:51 pm on Feb 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Please post the code you've been testing as a basis for further discussion.

Thanks,
Jim

kishkush

2:10 pm on Feb 21, 2007 (gmt 0)

10+ Year Member



tried the following two rules

#RewriteRule ^component/component/option,com_frontpage/Itemid.*$ [domain.com...] [R=permanent,L]

and this one

#RedirectPermanent [domain.com...] [domain.com...]

nothing works, commented both :(

jdMorgan

3:10 pm on Feb 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Possibly:

RedirectPermanent /component/option,com_frontpage/Itemid,1/ http://www.example.com/
-or-
RedirectMatch 301 ^/component/option,com_frontpage/Itemid,[0-9]+/$ http://www.example.com/

You didn't say if you have other RewriteRules that work. If not, you will likely need to 'set up' mod_rewrite by adding one or more of the following directives before your RewriteRule:


Options +FollowSymLinks
RewriteEngine on
#
RewriteRule ^component/component/option,com_frontpage/Itemid,[0-9]/$ http://www.example.com/ [R=301,L]

I'm also suspicious that Apache may not work as expected with commas in the URL. While commas are valid in query strings, they are 'reserved' characters which must be escaped (hex-encoded) and I don't often see them in the URL-part. See RFC2396 [faqs.org] for more info.

Jim

kishkush

3:27 pm on Feb 21, 2007 (gmt 0)

10+ Year Member



friend of mine just changed to

RewriteRule ^component/option\,com\_frontpage/Itemid\,1 [domain.com...] [R]

and now everything is working :)

thanks alot :)

jdMorgan

5:46 pm on Feb 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Include the trailing slash to avoid a redirect on every request!

Jim

kishkush

8:21 pm on Feb 21, 2007 (gmt 0)

10+ Year Member



you mean like this:

RewriteRule ^component/option\,com\_frontpage/Itemid\,1/ [domain.com...] [R]

?

jdMorgan

9:13 pm on Feb 21, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member




RewriteRule ^component/option\,com\_frontpage/Itemid\,1 http://www.example.[b]com/[/b] [R=301,L]

Jim