GIDForums  

Go Back   GIDForums > Web Hosting Forums > Apache Web Server Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 20-Jan-2005, 03:01
SID SID is offline
New Member
 
Join Date: Jan 2005
Posts: 5
SID is on a distinguished road
Question

Help please


Hello all - anyone help please?
~~~~~~~~~~~~~~~~~
Can anyone rewite this for me to tidy it up/correctly write it but also to include the ability to work with or without www. as it currently only works without.
~~~~~~~~~
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule ^.*$ /%1\.php [R,QSA]
~~~~~~~~~
Thank you.
  #2  
Old 20-Jan-2005, 07:25
Div's Avatar
Div Div is offline
Moderator
 
Join Date: May 2002
Posts: 996
Div has a spectacular aura aboutDiv has a spectacular aura about
You should start out by specifying what you are trying to accomplish.
__________________
Web Hosting Tips | Career Advice
  #3  
Old 20-Jan-2005, 07:59
SID SID is offline
New Member
 
Join Date: Jan 2005
Posts: 5
SID is on a distinguished road
Question

Help needed please


Quote:
Originally Posted by Div
You should start out by specifying what you are trying to accomplish.

Can anyone help me sort the following out please. I am trying to accomplish the opening of a php file that corresponds to the same name as "subdomain" name. E.G if this is called: mysub.domain.com then the .htaccess file would open this file » mysub.php ( located in the same folder as the .htaccess file )
I currently have this working but only with non www. input & I need to have it working for both www. & non.www usage. I adapted something from what I saw elsewhere so it will also need correcting if anyone can help. I have *Wildcards enabled but do not have httpd conf access.
~~~~~~~~~~~~~~~
RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$ [NC]
RewriteCond %1 !^www$ [NC]
RewriteRule ^.*$ /%1\.php [R,QSA]
~~~~~~~~~~~~~~~
I would also appreciate the call for the final file being by way of 301 Permanent Redirect if that is also possible................thanks.
  #4  
Old 20-Jan-2005, 08:39
SID SID is offline
New Member
 
Join Date: Jan 2005
Posts: 5
SID is on a distinguished road

thanks but.......


dosent seem to work......it pulls index.php if you use www. or if you don't use www. - Is it just possible to adapt the one I supplied to include www. usage as at least I know that that does work at least with non www. usage?

Thanks
  #5  
Old 20-Jan-2005, 08:43
Div's Avatar
Div Div is offline
Moderator
 
Join Date: May 2002
Posts: 996
Div has a spectacular aura aboutDiv has a spectacular aura about
Quote:
I currently have this working but only with non www. input & I need to have it working for both www. & non.www usage.

I would recommend redirecting the www requests to the non-www address. So,

www.subdomain.example.com would be redirected to subdomain.example.com
__________________
Web Hosting Tips | Career Advice
  #6  
Old 20-Jan-2005, 08:51
SID SID is offline
New Member
 
Join Date: Jan 2005
Posts: 5
SID is on a distinguished road

ok thanks


thanks....thats not so bad as the final php file that gets pulled will contain a final redirect anyway.........how can I implement what you say inside the .htaccess file? I need to get as much done inside that file for 301 reasons, also can you advise on the final 301 transition to the final php file?

Thanks again
 
 

Recent GIDBlogA Week in Kuwait by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 01:47.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.