Forum Moderators: phranque

Message Too Old, No Replies

Need help with mod rewrite

mod_rewrite apache htaccess .htaccess sh404SEF

         

Captain Midnight

7:45 pm on Aug 19, 2009 (gmt 0)

10+ Year Member



I need some assistance in mod_rewriting. For instance, I'm using Joomla 1.5+, w/sh404SEF and would do it manually there if possible, but I think I need to look closer at the .htacess and creating something fancy there.

Here's what my delima is.. I want to take a current SEF URL and use a sub-domain instead. For example:

CURRENT:
http://www.example.com/business-directory/Florist-Retail.html (Florist Retail Category)

TO:
[florist-retail.example.com...]

If it's possible to add that into the Joomla sh404SEF component, I would do it.. but I think I'm going to need to modify my .htaccess file to get that to work.

Any suggestions are greatly appreciated.

Thanks in advance!
Shane

jdMorgan

4:18 am on Aug 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Since our focus is Apache server here, I can't answer for Joomla and sh404SEF -- No idea what they do when combined, frankly...

But we've discussed subdomain to subdirectory rewriting quite often here, so you should be able to find many previous threads on that subject.

One caveat is that your "category" (florist-retail) will have to be carefully-controlled, because the rules on what constitutes a valid domain component are quite restrictive: Letters and numbers and hyphens only, and the first character must be a letter. So do be careful with that aspect of this project.

Jim

Captain Midnight

3:00 pm on Aug 20, 2009 (gmt 0)

10+ Year Member



Thank jd -- I'll look around a bit more. This one just happened to be a bit interesting because the sh404SEF was already rewriting the URI from something like: example.com/index.php?blah=blah_blah&234, etc. to example.com/blah and by adding another layer of rewrite for the category to subdomain is where my issue is... I'll look around for some sh404SEF help.

Thanks for the reply.
Shane

g1smd

10:41 pm on Aug 20, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



the sh404SEF was already rewriting the URI from something like: example.com/index.php?blah=blah_blah&234, etc. to example.com/blah

Note that your explanation above is exactly backwards.

This is how the rewrite actually works:

The Pattern in the RewriteRule matches an incoming URL request for:

example.com/blah

The Rule then causes the server to look in internal filepath:
/index.php?blah=blah_blah&234
for the content.

The distinction between URLs 'used on the web' and internal filepaths 'used inside the server' may seem pedantic, but is crucial to the understanding of this stuff.