Welcome to WebmasterWorld Guest from 54.145.209.107

Forum Moderators: Ocean10000 & incrediBILL & phranque

rewrite on Go Daddy giving pain

rewrite on Go Daddy giving pain

   
8:07 pm on Apr 26, 2012 (gmt 0)

5+ Year Member



Ok, so with other hosts I do not have this issue. I've got some simple rules in place

RewriteEngine on
RewriteCond %{HTTP_HOST} ^experiencetejas.com$

RewriteRule ^([a-z0-9_-]+)$ /$1/ [R=301,L]
RewriteRule ^([a-z0-9_-]+)/$ /index.php?page_name=$1


However, because Go Daddy forces you to create sub domains in the same folder as the main site my rewite rules are taking affect on the sub domain, which is not what I want.

I tried to write the condition in there but it does not seem to help. I've already spent about an hour trying to figure this out but not really getting anywhere. Does anyone have a suggestion on how to only make the write rule apply to the main site and not the sub domains? Also, I am not using www in front, just http://
8:55 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



There's multiple problems with your rules.

Literal periods in patterns should be escaped.

The redirect target should contain the protocol and domain name.

The internal rewrite should include the [L] flag.

Why are you adding a slash to the URLs for pages? URLs ending with a slash are for folders.

Add a blank line after each RewriteRule so you can clearly see what code is grouped together.
9:05 pm on Apr 26, 2012 (gmt 0)

5+ Year Member



Do you mean like this
RewriteCond %{HTTP_HOST} ^http://experiencetejas\.com$ [L]

as for slashes i like all the URLs to look like website.com/about/ and not website.com/about
9:28 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



Use a trailing slash only when the URL is for a folder or the index page in a folder.

Make sure too that you use URLs beginning with a leading slash in the links to other pages of your site.
9:53 pm on Apr 26, 2012 (gmt 0)

5+ Year Member



can you comment on this
RewriteCond %{HTTP_HOST} ^http://experiencetejas\.com$ [L]
10:00 pm on Apr 26, 2012 (gmt 0)

5+ Year Member



whenever I put the [L] in there I get a 500 Internal server error, also I need to remind you this is only happening on Godaddy shared hosting
10:07 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The [L] flag belongs on the RewriteRule that will follow the RewriteCond, not on the RewriteCond itself.

Add a blank line after each RewriteRule in order to make the code clearer to read.
10:16 pm on Apr 26, 2012 (gmt 0)

5+ Year Member



Well I've been fooling with this all day and I can not get it to work. Simply put, the rewrite is affecting admin.website.com and I dont want it to!

Again, here is where I am

RewriteEngine on

RewriteCond %{HTTP_HOST} ^(www\.)?experiencetejas\.com$ [NC]

RewriteRule ^([a-z0-9_-]+)$ /$1/ [R=301,L]

RewriteRule ^([a-z0-9_-]+)/$ /index.php?page_name=$1 [NC,QSA]
11:13 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member g1smd is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



The redirect target should contain the protocol and domain name.

The internal rewrite should include the [L] flag.
11:19 pm on Apr 26, 2012 (gmt 0)

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



RewriteCond %{HTTP_HOST} ^experiencetejas.com$

RewriteRule ^([a-z0-9_-]+)$ /$1/ [R=301,L]
RewriteRule ^([a-z0-9_-]+)/$ /index.php?page_name=$1

I have to say this line-spacing makes me uneasy. It makes it look as if you expect the Condition to apply to both of the following Rules. For clarity, it should be

RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^([a-z0-9_-]+)$ /$1/ [R=301,L]

RewriteRule ^([a-z0-9_-]+)/$ /index.php?page_name=$1

... plus all other appropriate changes to the Rules themselves as laid out in g1's posts.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month