[joomla] www.xx.com/content --> http://content.xx.com

Using mod_rewrite to handle various content issues

[joomla] www.xx.com/content --> http://content.xx.com

Postby LeGeND » Mon Aug 20, 2007 10:35 pm

hi;

i want to dynamic subdomains with url. i want to do like below. and i'm using artio joomsef

original artio joomsef settings --> settings that i want to do

http://www.xxx.com/categoryname --> http://categoryname.xxx.com
http://www.xxx.com/categoryname/content.html --> http://content.xxx.com
http://www.xxx.com/contact.html (or something else) --> http://contact.xxx.com

how can i do this?

kind regards
LeGeND
 
Posts: 11
Joined: Mon Aug 20, 2007 10:25 pm

Postby richardk » Tue Aug 21, 2007 3:45 pm

For sub domains you will need DNS for them. All these sub domains will need to go to your document root.

i'm using artio joomsef

Post your current mod_rewrite. It may also be easier if you ask them as they know more about Joomla (which will probably need editing).

http://www.xxx.com/categoryname --> http://categoryname.xxx.com

That's easy enough.

http://www.xxx.com/categoryname/content.html --> http://content.xxx.com
http://www.xxx.com/contact.html (or something else) --> http://contact.xxx.com

It will be difficult to do that (sub domains to different levels). Which one would take precedence, for example if there was a /abc.html and a /dir/abc.html which one would abc.domain.com go to?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby LeGeND » Wed Sep 05, 2007 6:50 am

hi

thanks for your reply. my.htaccess file is below.

Code: Select all
##
# @version $Id: htaccess.txt 2368 2006-02-14 17:40:02Z stingrey $
# @package Joomla
# @copyright Copyright (C) 2005 Open Source Matters. All rights reserved.
# @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
# Joomla! is Free Software
##


#####################################################
#  READ THIS COMPLETELY IF YOU CHOOSE TO USE THIS FILE
#
# The line just below this section: 'Options FollowSymLinks' may cause problems
# with some server configurations.  It is required for use of mod_rewrite, but may already
# be set by your server administrator in a way that dissallows changing it in
# your .htaccess file.  If using it causes your server to error out, comment it out (add # to
# beginning of line), reload your site in your browser and test your sef url's.  If they work,
# it has been set by your server administrator and you do not need it set here.
#
# Only use one of the two SEF sections that follow.  Lines that can be uncommented
# (and thus used) have only one #.  Lines with two #'s should not be uncommented
# In the section that you don't use, all lines should start with #
#
# For Standard SEF, use the standard SEF section.  You can comment out
# all of the RewriteCond lines and reduce your server's load if you
# don't have directories in your root named 'component' or 'content'
#
# If you are using a 3rd Party SEF or the Core SEF solution
# uncomment all of the lines in the '3rd Party or Core SEF' section
#
#####################################################

#####  SOLVING PROBLEMS WITH COMPONENT URL's that don't work #####
# SPECIAL NOTE FOR SMF USERS WHEN SMF IS INTEGRATED AND BRIDGED
# OR ANY SITUATION WHERE A COMPONENT's URL's AREN't WORKING
#
# In both the 'Standard SEF', and '3rd Party or Core SEF' sections the line:
# RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
# May need to be uncommented.  If you are running your Joomla! from
# a subdirectory the name of the subdirectory will need to be inserted into this
# line.  For example, if your Joomla! is in a subdirectory called '/test/',
# change this:
# RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
# to this:
# RewriteCond %{REQUEST_URI} ^(/test/component/option,com) [NC,OR] ##optional - see notes##
#
#####################################################


##  Can be commented out if causes errors, see notes above.
Options FollowSymLinks

#
#  mod_rewrite in use

RewriteEngine On


#  Uncomment following line if your webserver's URL
#  is not directly related to physical file paths.
#  Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin Standard SEF Section
## ALL (RewriteCond) lines in this section are only required if you actually
## have directories named 'content' or 'component' on your server
## If you do not have directories with these names, comment them out.
#
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]       ##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
#RewriteRule ^(content/|component/) index.php
#
########## End Standard SEF Section


########## Begin 3rd Party or Core SEF Section
#
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR]       ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$  [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
#
########## End 3rd Party or Core SEF Section


category name for sef it can be xxx.com/categoryname it is not important. but important thing that i want to rewrite content (xxx.com/category/content.html or xxx.com/content.html) as content.xxx.com.

thamks for your helps.
LeGeND
 
Posts: 11
Joined: Mon Aug 20, 2007 10:25 pm

Postby richardk » Wed Sep 05, 2007 2:31 pm

but important thing that i want to rewrite content (xxx.com/category/content.html or xxx.com/content.html) as content.xxx.com.

You can't do that. There's no way for mod_rewrite to know where content.domain.com should go. You need to make them unique, eg. category-content.domain.com to /category/content.html and content.domain.com to /content.html.

And for categories you'd need something unique too, as category.domain.com is the same as content.domain.com.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby LeGeND » Thu Sep 06, 2007 6:04 am

ok.

how can i do this rewrite that you said? (content-category.domain.com for domain.com/category/content.html and content.domain.com for domain.com/content.html)

thanks

edit: or it is enough that rewriting category.domain.com for domain.com/category.

it would be better we could make that i talking about.
LeGeND
 
Posts: 11
Joined: Mon Aug 20, 2007 10:25 pm

Postby richardk » Thu Sep 06, 2007 3:19 pm

Actually, the mod_rewrite isn't a problem at all, your current mod_rewrite will work. You just have to make the sub domains go to your document root and edit the PHP to make it understand your new URLs.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby LeGeND » Mon Sep 10, 2007 3:21 am

richardk wrote:Actually, the mod_rewrite isn't a problem at all, your current mod_rewrite will work. You just have to make the sub domains go to your document root and edit the PHP to make it understand your new URLs.


making sub domains? how can i do that? i looked up the artio files but not exactly solution on files.

thanks
LeGeND
 
Posts: 11
Joined: Mon Aug 20, 2007 10:25 pm

Postby richardk » Mon Sep 10, 2007 1:41 pm

making sub domains? how can i do that?

Through your domain and/or hosting administration panel.

i looked up the artio files but not exactly solution on files.

You could ask the artio author(s).

This seems like a lot of effort for nothing.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby LeGeND » Thu Sep 20, 2007 7:36 am

hi again;

so; how can we do www.xxx.com/category/index.php to www.xxx.com/category/ and www.xxx.com/category/content.html to www.xxx.com/category/content/

thanks again for your efforts.

note: it's using this htaccess

## Can be commented out if causes errors, see notes above.
Options FollowSymLinks

#
# mod_rewrite in use

RewriteEngine On


# Uncomment following line if your webserver's URL
# is not directly related to physical file paths.
# Update Your Joomla! Directory (just / for root)

# RewriteBase /


########## Begin Standard SEF Section
## ALL (RewriteCond) lines in this section are only required if you actually
## have directories named 'content' or 'component' on your server
## If you do not have directories with these names, comment them out.
#
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
#RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
#RewriteRule ^(content/|component/) index.php
#
########## End Standard SEF Section


########## Begin 3rd Party or Core SEF Section
#
#RewriteCond %{REQUEST_URI} ^(/component/option,com) [NC,OR] ##optional - see notes##
RewriteCond %{REQUEST_URI} (/|\.htm|\.php|\.html|/[^.]*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php
#
########## End 3rd Party or Core SEF Section
LeGeND
 
Posts: 11
Joined: Mon Aug 20, 2007 10:25 pm

Postby richardk » Thu Sep 20, 2007 1:32 pm

What URLs do you want to be shown in the address bar? What happens if you go to it now?

The current mod_rewrite will match that URL so changing the PHP will work. If it uses the REQUEST_URI variable in the PHP then you can't do it with mod_rewrite.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Content

Who is online

Users browsing this forum: No registered users and 11 guests

cron