Forum Moderators: phranque

Message Too Old, No Replies

Rewriting urls in apache

Going nuts with this

         

mystxx

8:21 am on Sep 25, 2006 (gmt 0)

10+ Year Member



Hi. I have browsed this forum a few times allready, really a lot of rewriting posts here, but after a ton of reading, I'm still too stupid to pull out my own htaccess file.

I'm posting the specification below, I'm asking for someone to help me build it according to what I need:

This is the case:
I need
www.mydomain.com to go to www.mydomain.com or home/user/public_html
Also, www.mydomain.com/anyfile.ext to go to www.mydomain.com/anyfile.ext

Then,
subdomain.mydomain.com to subdomain.mydomain.com/index.php or /home/user/public_html/subdomain/index.php
subdomain.mydomain.com/somephpfile.php to /home/user/public_html/subdomain/somephpfile.php
subdomain.mydomain.com/l-1-2-3.html to /home/user/public_html/subdomain/index.php?q1=1&q2=2&q3=3
subdomain.mydomain.com/c/1/2.html to /home/user/public_html/subdomain/index.php?m1=1&m2=2
subdomain.mydomain.com/n/1/2.html to /home/user/public_html/subdomain/index.php?m1=1&m2=2

Then,
subdomain.mydomain.com/styles/mystyle1/style1.css to /home/user/public_html/subdomain/styles/mystyle1/style1.css
subdomain.mydomain.com/styles/scripts/script1.js to /home/user/public_html/subdomain/styles/scripts/script1.js

Then
subdomain.mydomain.com/images/image1.jpg to /home/user/public_html/subdomain/images/image1.jpg

Then
subdomain.mydomain.com/images/image1.jpg to /home/user/public_html/subdomain/images/image1.jpg

And at last:
subdomain.mydomain.com/admin/admin.php?q1=1&q2=2&q3=3&.... to /home/user/public_html/subdomain/admin/admin.php?q1=1&q2=2&q3=3.... basically, just pass on the query string.

I've been banging my head on the wall for the last 5 days with this. Finally, I deleted all of my htaccess files, wanted to start over with a little help. I don't know if this is a big request, but just some pointers would probably do it.

Thanx.

ASchmitt

8:46 am on Sep 25, 2006 (gmt 0)

10+ Year Member



hey, I don't know if you need htaccess in this example... normally, when dns domainname settings are correct and you use the correct nameservers, your domainname should automaticly point to your public_html folder... and so everything will follow... try checking your settings...

mystxx

10:14 am on Sep 25, 2006 (gmt 0)

10+ Year Member



Hi.
I have the setup to anything.mydomain.com be redirected to mydomain.com in public_html.
I just wrote public_html since I wanted to give as much possible details to where should the rewriting go.

Thanx.

jdMorgan

7:19 pm on Sep 26, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You should be able to handle this with some code in a .htaccess file in /public_html.

For a good start on this project, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim