Click to See Complete Forum and Search --> : [RESOLVED] Apache Rewrite (on GoDaddy)


mramonster
08-12-2008, 06:09 PM
I am having some real issues with my rewrite on the .htaccess for my GoDaddy Account. I found a few web pages that have a lot of help but I am unable to get it to work on my sites in a positive way.

I have 2 sites that I need to figure out how to get the rewrite to work. Site one (mmh.com) is in the root directory. Site two (mhm.com) is in the folder /mhm off of the root directory.

First I need mmh.com to do a 301 redirect to mhm.com.

And then I need to be able to do "pretty permalinks" to the following address:
mhm.com/event.php?url=event-name-here

Here's what I've got and I have placed it in the ROOT (mmh.com) Directory:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /

############## rewrite to www.mhm.com
RewriteCond %{HTTP_HOST} ^mhm\.com [NC]
RewriteRule (.*) http://www.mhm.com/$1 [R=301,L,NC]
RewriteCond %{HTTP_HOST} ^mmh\.com [NC]
RewriteRule (.*) http://www.mhm.com/$1 [R=301,L,NC]
RewriteCond %{HTTP_HOST} ^www.mmh\.com [NC]
RewriteRule (.*) http://www.mhm.com/$1 [R=301,L,NC]
################

##############
RewriteCond %{REQUEST_FILENAME} !-f
# uncomment if you want to exclude certain URLs: RewriteCond %{REQUEST_URI} !example.php
RewriteCond %{REQUEST_URI} !(.*)/$
RewriteRule ^mhm/(.*)$ http://www.mhm.com/$1/ [L,R=301]
#################

I know it can be done because I have wordpress, joomla and other open sources that work on my other godaddy hosting just fine. I've tried to use the coding for that to apply to these sites and it doesn't seem to work. It is turned on because I was able to redirect mmh.com to mhm.com for a while but I messed it up somewhere along the lines.

edit: of course GoDaddy doesn't help with .htaccess files and I'd really prefer to stick with them.

mramonster
08-13-2008, 04:07 PM
49 views and no help :(

mramonster
08-13-2008, 06:21 PM
Apparently GoDaddy has updated their hosting recently and it is no longer necessary to put it all into the root directory. With that said all I need to do it redirect:

http://www.motorheadmonster.com/event2.php?url=2008-08-16-Enid-Blue-Knights-Summer-Run
to look like
http://www.motorheadmonster.com/event2/url/2008-08-16-Enid-Blue-Knights-Summer-Run/

I have been working on this for several hours and am currently on this:

Options +FollowSymLinks
rewritecond %{http_host} ^mysitecom [nc]
rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]

RewriteRule event2/(.*)/(.*)/$ /event2.php?$1=$2

Finally got A code to work right after going through hours of it:
Options +FollowSymLinks
RewriteEngine on
rewritebase /
rewritecond %{http_host} ^mysite.com [nc]
rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc]

RewriteRule event2-url-(.*)\.html event2.php?url=$1