Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar Mark Forums Read
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-15-2009, 08:50 PM   #1
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
.Htaccess/Mod_Rewrite ninjas inside plz.

Ok, I am doing a simple domain.com to www.domain.com redirect, and it works fine, but if you go to domain.com/somepage.html it redirects to www.domain.com/ instead of www.domain.com/somepage.html.

Anyone know why? And how to fix it?

Code:
<IfModule mod_rewrite.c>

  RewriteEngine On

  Options +FollowSymLinks
  Options +Indexes

  ErrorDocument 404 /

  RewriteBase /
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . / [L]

  RewriteCond %{HTTP_HOST} ^([^.]+\.(com|net|org)) [NC]
  RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]

</IfModule>
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 08:55 PM   #2
alias
aliasx
 
alias's Avatar
 
Join Date: Apr 2001
Posts: 19,010
Try a full document url for the 404 /

eg:

ErrorDocument 404 /404.html

or you could use a full url
ErrorDocument 404 http://www.someserver.com/404.html
__________________
https://porncorporation.com
alias is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 08:57 PM   #3
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
This is my non-www to www redirection code. Might be of use.

Code:
#WWW Redirect
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 09:03 PM   #4
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Quote:
Originally Posted by alias View Post
Try a full document url for the 404 /

eg:

ErrorDocument 404 /404.html

or you could use a full url
ErrorDocument 404 http://www.someserver.com/404.html
ErrorDocument doesn't effect it, it's the WWW redirection that isn't working properly or something.

Quote:
Originally Posted by JamesK View Post
This is my non-www to www redirection code. Might be of use.

Code:
#WWW Redirect
RewriteBase /
RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://www.domain.com/$1 [L,R=301]
Mine is the same as yours, except I use regex in mine so I don't have to edit it and can just upload the same .htaccess file to any new site I create without editing anything, which is what I want, since my framework doesn't need anything different. Works for any domain with .com/net/org.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 09:11 PM   #5
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Edit: Scratch that...
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 09:15 PM   #6
alias
aliasx
 
alias's Avatar
 
Join Date: Apr 2001
Posts: 19,010
You added ! then $ and it worked? cool!$
__________________
https://porncorporation.com
alias is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 09:41 PM   #7
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Gah, still not fucking working.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 09:59 PM   #8
alias
aliasx
 
alias's Avatar
 
Join Date: Apr 2001
Posts: 19,010
Bump, I tried to help. No luck, Kill says he has mod rewrite active. This didn't work:

RewriteCond %{HTTP_HOST} !^www.dom.com$ [NC]
RewriteRule ^(.*)$ http://www.dom.com/$1 [R,L]
__________________
https://porncorporation.com
alias is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 10:12 PM   #9
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
It's redirecting the domain properly, but during the redirection, it's killing any actual directory and or pages you have after it.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-15-2009, 10:29 PM   #10
mikeyddddd
Viva la vulva!
 
mikeyddddd's Avatar
 
Join Date: Mar 2003
Location: you can't please everyone, so you got to please yourself
Posts: 16,557
This is what I use:

Code:
RewriteEngine On 
RewriteCond %{HTTP_HOST} !^www\.mikeyddddd\.com$ [NC]
Rewriterule (.*) http://www.mikeyddddd.com/$1 [R=301]
mikeyddddd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 12:27 AM   #11
borked
Totally Borked
 
borked's Avatar
 
Industry Role:
Join Date: Feb 2005
Posts: 6,284
and to add my , this is what I use:

Code:
RewriteEngine on
rewritecond %{http_host} ^domain\.com [nc]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc,L]
edit - to add mine's different than the others' above, cos I *only* want to rewrite domain.com->www.domain.com
hence the ^domain.com
the others use !^www.domain.com
which would rewrite subdomain.domain.com which I can't have
__________________

For coding work - hit me up on andy // borkedcoder // com
(consider figuring out the email as test #1)



All models are wrong, but some are useful. George E.P. Box. p202

Last edited by borked; 11-16-2009 at 12:29 AM..
borked is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 12:37 AM   #12
mmcfadden
So Fucking Banned
 
Join Date: Oct 2008
Location: philly
Posts: 5,099
and I will just post so I can find this thread later
mmcfadden is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 05:51 AM   #13
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,270
try this

Code:
RewriteCond %{HTTP_HOST} ^([^.]+\.(com|net|org)) [NC]
RewriteRule .* http://%1%{REQUEST_URI} [R=301,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 06:03 AM   #14
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,270
should be this actually

Code:
RewriteCond %{HTTP_HOST} ^([^.]+\.(com|net|org)) [NC]
RewriteRule .* http://www.%1%{REQUEST_URI} [R=301,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 06:16 AM   #15
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,270
also try this one

Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 07:39 AM   #16
JamesK
hi
 
Industry Role:
Join Date: Jun 2002
Posts: 16,731
fris to the rescue
__________________
M3Server - NATS Hosting
JamesK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 01:41 PM   #17
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Neither work still, no fucking clue wtf is going on, I'll have to talk to tech at AmeriNOC maybe something with the server I'm on.
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 02:31 PM   #18
Doctor Feelgood
Confirmed User
 
Doctor Feelgood's Avatar
 
Industry Role:
Join Date: Nov 2005
Location: RI
Posts: 2,112
all of yous are wrong, this is what he wants

Code:
rewritecond %{HTTP_HOST} ^yoursite\.com 
RewriteRule ^(.*) http://www.yoursite.com/$1 [L,R=301]
Doctor Feelgood is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-16-2009, 04:24 PM   #19
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,270
Quote:
Originally Posted by Doctor Feelgood View Post
all of yous are wrong, this is what he wants

Code:
rewritecond %{HTTP_HOST} ^yoursite\.com 
RewriteRule ^(.*) http://www.yoursite.com/$1 [L,R=301]
ya he wants it so he can place in any domain without editing each .htaccess
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-27-2009, 09:37 PM   #20
Killswitch - BANNED FOR LIFE
Guest
 
Posts: n/a
Thanks for everyones help, but I finally after giving it another whirl today, got it.

Problem? I put the code just below RewriteBase /

Code:
<IfModule mod_rewrite.c>

  RewriteEngine On

  Options +FollowSymLinks
  Options +Indexes

  ErrorDocument 404 /

  RewriteBase /
  RewriteCond %{HTTP_HOST} ^([^.]+\.(com|net|org))$ [NC]
  RewriteRule ^(.*)$ http://www.%1/$1 [L,R=301]

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule . / [L]

</IfModule>
  Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-28-2009, 03:15 AM   #21
Robocrop
Confirmed User
 
Robocrop's Avatar
 
Industry Role:
Join Date: Aug 2008
Location: Hollywood
Posts: 2,785
Hows your Tube script turning out btw?
Robocrop is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks
Thread Tools



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.