Forum Moderators: phranque
I have added some content to my .htacces file that should help me in getting the URL
[mydomain.com...]
when I type either
[mydomain.com...]
or
[mydomain.com...]
In both cases I get the URL
[mydomain.com...]
though.
This is what is in my .htacces file:
RewriteEngine on
RewriteBase /
RewriteRule ^$ /benvenuti.html [R]
RewriteCond %{QUERY_STRING} ^l=italian$
RewriteRule ^welcome\.html$ /benvenuti.html [R]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^benvenuti\.html /welcome.html?l=italian [L]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^benvenuti\.html /welcome.html?l=italian&%1 [L]
RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(welcome¦aboutMe¦cv¦tasks¦contact)\.html$ /index.php?m=$1 [L]
RewriteCond %{QUERY_STRING} ^(.+)$
RewriteRule ^(welcome¦aboutMe¦cv¦tasks¦contact)\.html$ /index.php?m=$1&%1 [L]
Can anyone tell me what is wrong? Any help is greatly appreciated <:}
Thanks,
Stine
[edited by: Stine at 3:29 pm (utc) on Jan. 14, 2005]
How about this simpler version?
# declare default page for "/"
DirectoryIndex benvenuti.html
#
# added "?" to clear the query string
RewriteCond %{QUERY_STRING} ^l=italian$
RewriteRule ^welcome\.html$ /benvenuti.htm[b]l?[/b] [R=301,L]
#
# this replaces two rules by detecting missing "l=italian" query and using [QSA]
RewriteCond %{QUERY_STRING} !l=italian
RewriteRule ^benvenuti\.html /welcome.html?l=italian [QSA,L]
#
# this replaces two rules by detecting missing "m=" query and using [QSA]
RewriteCond %{QUERY_STRING} !m=
RewriteRule ^(welcome¦aboutMe¦cv¦tasks¦contact)\.html$ /index.php?m=$1 [QSA,L]
Jim
Please provide more information in your posts. We cannot see your monitor. If you make us ask a whole bunch of questions to help fix *your* problems, then this will take a very long time.
What URL did you request with your browser?
What URL is in the browser address bar when you see this "You are not authorized"?
Are you seeing this your 401-Authentication Required page, or your 403-Forbidden page?
What is in your server error log file after this error happens?
What other code in httpd.conf, .htaccess files, or scripts, do you have that requires authorization or might invoke a 403-Forbidden response? (There is certainly no change that I proposed that would invoke authorization).
Jim
If this is the case, then the following code should prevent the looping:
# declare default page for "/"
DirectoryIndex benvenuti.html
#
# added "?" to clear the query string
[b]RewriteCond %{THE_REQUEST} /welcome\.html\?l=italian[/b]
RewriteRule ^welcome\.html$ http://www.yourdomain.com/benvenuti.html? [R=301,L]
#
# this replaces two rules by detecting missing "l=italian" query and using [QSA]
RewriteCond %{QUERY_STRING} !l=italian
RewriteRule ^benvenuti\.html /welcome.html?l=italian [QSA,L]
#
# this replaces two rules by detecting missing "m=" query and using [QSA]
RewriteCond %{QUERY_STRING} !m=
RewriteRule ^(welcome¦aboutMe¦cv¦tasks¦contact)\.html$ /index.php?m=$1 [QSA,L]
# Error page for "Authentication Required" (Incorrect username or password was entered)
ErrorDocument 401 /401err.html
#
# Error page for "Not Found" (Requested resource was not found - reason unknown)
ErrorDocument 404 /404err.html
#
# Error page for "Gone" (Requested resource was not found because it has been intentionally deleted)
ErrorDocument 410 /410err.html
#
# Error page for "Server Error" (Any internal server error)
ErrorDocument 500 /500err.html
Jim
Thanks a lot for your thorough replies!
After replacing DirectoryIndex benvenuti.html by RewriteRule ^$ /benvenuti.html [R=301] and removing the first two L's it worked just fine! And now I know about QSA:} Thanks!
My only problem now is that my hidden values (<INPUT TYPE="HIDDEN" NAME=...) do not seem to survive the rewriting! I cannot fetch them from the $_POST (im doing php) at least... do you happen to be familiar with this problem?<:}
Thanks,
Stine