Connecting Tech Pros Worldwide Help | Site Map

htaccess Rewrite on 1and1 hosting

hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#1: Jun 9 '09
I had a .htaccess file for Rewrite on my server and was working fine. Now when I used the same code in 1and1 hosting, its not working.

May be something is wrong or unexpectedly good happening inside 1and1 servers.

Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteRule /id/(.*)/name/(.*) index.php?id=$1&name=$2
If anyone knows what's required to be changed to make it work on 1and1, please let me know.

Thanks
Dormilich's Avatar
Moderator
 
Join Date: Aug 2008
Location: Leipzig, Germany
Posts: 3,635
#2: Jun 9 '09

re: htaccess Rewrite on 1and1 hosting


does your 1&1 account support mod_rewrite? (check in phpinfo())
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#3: Jun 9 '09

re: htaccess Rewrite on 1and1 hosting


Check your error logs (apache).

Moved this to misc because it isn't PHP nor Apache.
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#4: Jun 9 '09

re: htaccess Rewrite on 1and1 hosting


Quote:

Originally Posted by Markus View Post

Moved this to misc because it isn't PHP nor Apache.

At least people go to PHP forum... no body goes to misc. ;)

Anyway, I think there's some problem with 1and1 ... many people have similar problem, and nobody got any solution.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#5: Jun 9 '09

re: htaccess Rewrite on 1and1 hosting


Quote:

Originally Posted by hsriat View Post

At least people go to PHP forum... no body goes to misc. ;)

Anyway, I think there's some problem with 1and1 ... many people have similar problem, and nobody got any solution.

I disagree; I go to misc on my daily 'rounds'. But, then again, I have a pretty boring life at the moment.

Try a host better than 1and1?
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#6: Jun 11 '09

re: htaccess Rewrite on 1and1 hosting


Umm... that's what is not in my hands.

Anyhow, can you tell me how would you do this rewrite:

www.example.com/index.php?id=wolves&name=Markus
to
www.example.com/wolves/Markus

What I did was this:
Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteBase /
  4. RewriteRule /([^/]+)/([^/]+) /index.php?id=$1&name=$2 [L]
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#7: Jun 11 '09

re: htaccess Rewrite on 1and1 hosting


Quote:

Originally Posted by hsriat View Post

Umm... that's what is not in my hands.

Anyhow, can you tell me how would you do this rewrite:

www.example.com/index.php?id=wolves&name=Markus
to
www.example.com/wolves/Markus

What I did was this:

Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteBase /
  4. RewriteRule /([^/]+)/([^/]+) /index.php?id=$1&name=$2 [L]

Sure. I'd do it something like this:

Expand|Select|Wrap|Line Numbers
  1. Options +FollowSymLinks
  2. RewriteEngine on
  3. RewriteBase /
  4. # Note: no leading /
  5. # Not sure what characters you want to allow, but you can expand the character set to incorporate them.
  6. RewriteRule ^([a-zA-Z0-9]+)/([a-zA-Z0-9]+)$ /index.php?id=$1&name=$2 [L]
  7.  
If you do only want to match alpha-numeric characters, you can use the expression '\w+' instead of the character sets [a-z...].
hsriat's Avatar
Expert
 
Join Date: Jan 2008
Location: Bath, UK
Posts: 1,609
#8: Jun 12 '09

re: htaccess Rewrite on 1and1 hosting


Unfortunately 1and1 didn't like this one too.

Anyhow, thanks for the help Markus.

Cheers
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,936
#9: Jun 12 '09

re: htaccess Rewrite on 1and1 hosting


Quote:

Originally Posted by hsriat View Post

Unfortunately 1and1 didn't like this one too.

Anyhow, thanks for the help Markus.

Cheers

That's a shame :/ I don't know how I'd live without .htaccess access...

Np,

Mark.
Reply