Forum Moderators: phranque
the 5 subdomains are ( all of them are categories)
electronics.example.com
sports.example.com
footwear.example.com
music.example.com
food.example.com
Then I want to do an internal rewrite using .htaccess( in public_html/) to the appropriate category link WITHOUT CHANGING THE URL
My htaccess code is something like this
===================================================
RewriteCond %{HTTP_HOST} ^(music\.)example.com
RewriteRule ^(.*)$ /index.php?option=com_cat&Itemid=229&cat_id=1234 [L]
===================================================
This gives me a 500 Internal Server Error
If I remove the rewrite rule and directly type the following in the url
[music.example.com...]
it works but I want the url only [music.example.com...]
if my code is modified as follows
===================================================
RewriteCond %{HTTP_HOST} ^(music\.)example.com
RewriteRule http://www.example.com/index.php?option=com_cat&Itemid=229&cat_id=1234 [L]
===================================================
it works but the url changes beacuse of the external redirect
Basically in short I want "http://music.example.com" to point to the music category link
"http://music.example.com/index.php?option=com_cat&Itemid=229&cat_id=1234"
My modrewrite knowledge is just 1 day old...reading the apache document is a pain for beginners like me...
Justin
[edited by: jdMorgan at 8:13 pm (utc) on Jan. 7, 2010]
[edit reason] example.com [/edit]
RewriteCond %{HTTP_HOST} ^music\.example\.com
RewriteRule !^index\.php$ /index.php?option=com_cat&Itemid=229&cat_id=1234 [L]
Jim
This is my code
RewriteCond %{HTTP_HOST} ^music\.example\.com
RewriteRule ^.*$ index.php?option=com_dating&Itemid=456&cat_id=5370&lang=en&task=showtopDates [L]
But If I type any other character instead of " ^.*$ " in the regex pattern
eg. " RewriteRule ^xyz$ index.php?option ..... "
and then access the url with eg music.example.com/xyz it works fine ...
I have tried .* , ^.* , !\s* and many more but still get the same blank page...
[edited by: jdMorgan at 11:01 pm (utc) on Jan. 7, 2010]
[edit reason] example.com [/edit]
If you do not, the request will be rewritten to "index.php?option=com_dating&Itemid=456&cat_id=5370&lang=en&task=showtopDates [L]", mod_rewrite processing will restart, and the request will be rewritten again. Lather, rinse, repeat. This will continue until the server gives up and logs a "Maximum internal redirect limit exceeeded" error.
Note also that you are rewriting *all* URLs in the music.example.com domain to your script. That means that your script must provide all images, css, JavaScript code, etc. as well as robots.txt and sitemap.xml when requested, and it must do so based on that *same* script-path and query string in each case. It must also properly handle requests for known-not-to-exist test URLs used by Google and Yahoo Webmaster tools, etc., and return a proper 404-Not Found response. Be sure that's what you actually want to do.
Jim
If I remove all the parameters "option=com_rating..." It works ! ..So I guess it has something to do with the parameters ?
Also I do have javascript,css etc having relative paths...I'll make it absolute
" and it must do so based on that *same* script-path and query string in each case "
I didnt quite understand this...are you saying that my query string too is appended in all the request...will making all the links absolute solve this ?
[edited by: jdMorgan at 8:14 am (utc) on Jan. 8, 2010]
[edit reason] example.com [/edit]
Is that what you want?
If not, you will need a more-specific pattern in your rule.
Jim