Results 1 to 3 of 3
-
08-19-2009, 08:18 AM #1Junior Guru Wannabe
- Join Date
- May 2002
- Posts
- 46
.htaccess for URL rewriting on 1and1
I am trying to install a php script on 1and1's shared home package. The script uses url rewriting for search friendly URLS. but it seems that 1and1 servers handles .htaccess file differently because the same script is working perfectly fine on my other host.
This is the actual .htaccess provided by the script:
Code:RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
Code:AddType x-mapp-php5 .php # 1and1 needed for php extensionless redirect. Options -MultiViews RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
the syntax of .htaccess is totally alien to me so I don't understand what does $1, [L,QSA] and other characters mean.Last edited by haris66; 08-19-2009 at 08:23 AM.
-
08-19-2009, 03:30 PM #2Junior Guru Wannabe
- Join Date
- May 2002
- Posts
- 46
forgot to tell you that the error is 404 not found.
-
08-19-2009, 06:55 PM #3Retired Moderator
- Join Date
- Feb 2005
- Location
- Australia
- Posts
- 5,849
The $1 means whatever is matched inside the brackets earlier on the same line (in this case, the page requested). In the square brackets at the end, L means "last" - stop processing here, QSA means "query string append", ie. add the "rt=pagerequested" to whatever else was in the query string already.
But that's all standard stuff - the original file you posted should work on most servers. Evidently 1and1 have an unusual setup that makes it fail. If you look in the logs you should see the filename that gives the 404 error (which may or may not be the page you originally requested).
One thing I'd try first would be to add a "RewriteBase" line (with or without the other mods you already tried), ie.
Code:RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?rt=$1 [L,QSA]
Edit: also perhaps try RewriteRule ^(.*)$ /index.php... etc.Chris
"Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them." - Laurence J. Peter
Similar Threads
-
Some Redirecting/Rewriting Problems wiht .htaccess
By mammos in forum Web Design and ContentReplies: 0Last Post: 09-12-2007, 02:43 PM -
htaccess rewrites not... well... rewriting.
By Strike1011 in forum Programming DiscussionReplies: 4Last Post: 07-21-2007, 08:45 PM -
mod_rewrite url rewriting.
By lachtan in forum Hosting Security and TechnologyReplies: 3Last Post: 02-18-2005, 03:53 PM -
Address rewriting?
By sbalmos in forum Hosting Security and TechnologyReplies: 1Last Post: 12-30-2004, 05:56 PM -
Mod Vhost & URL rewriting
By netserve in forum Hosting Security and TechnologyReplies: 0Last Post: 05-18-2001, 06:41 PM