PDA

View Full Version : mod_rewrite help



Shemo
September 21st, 2009, 15:24
I'm new to mod_rewrite and am in need of some help......

I figured most of it out, but I don't have a clue on how to rewrite a url for a subdomain.

basically, this is what I got so far and it works fine:

RewriteEngine on

RewriteRule ^home$ index.html [L]
RewriteRule ^gallery$ gallery.html [L]
RewriteRule ^upload$ upload.html [L]
RewriteRule ^links$ links.html [L]
RewriteRule ^support$ support.html [L]

my sub domains are:
blog.ugly-cars.com
gallery.ugly-cars.com


the gallery.html is already changed to /gallery, but gallery.ugly-cars.com is an iframe within the gallery.html page so it needs to have a rewrite done. the blog sub domain is just a simple word press blog that is its own page.

any help is appreciated.

themoose
September 21st, 2009, 18:47
You just put the rewrite rules in a new .htaccess in the subdomain folder rather than the root (or public_html) folder.

Shemo
September 21st, 2009, 22:14
You just put the rewrite rules in a new .htaccess in the subdomain folder rather than the root (or public_html) folder.

I figured out why my sub domains weren't working-I forgot I had directed my sub domains to a directory that I recently moved my files out of.

now....

when you visit this page:
http://www.ugly-cars.com/gallery

it should take you to this page:
http://www.ugly-cars.com/gallery.html

but it doesn't....it takes you to gallery.ugly-cars.com...any reason why?

Dynash
September 22nd, 2009, 09:52
http://www.ugly-cars.com/gallery stays the same for me.

Shemo
September 22nd, 2009, 13:38
http://www.ugly-cars.com/gallery stays the same for me.

that redirects to the actual photo gallery and not the gallery.html page that has the gallery embedded into the page with an iframe.

this is what the page should look like:
http://www.ugly-cars.com/gallery.html

I'm not sure why RewriteRule ^gallery$ gallery.html [L]
would make the page go to entire gallery and not the gallery.html page.

the rewrite rule works fine on all the other .html files as its supposed to.

themoose
September 22nd, 2009, 14:45
Do you have a folder called /gallery/ ?

Shemo
September 22nd, 2009, 17:32
Do you have a folder called /gallery/ ?

actually, I do..let me try renaming it to something else.

-that did the trick..thanks all.