I have a site that gets confused if someone logs in WITHOUT the "www" in their URL. Is there a way for index.php to automatically add the " This would be a huge help!
Thanks!
Thanks!
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
$pattern = "/^(http:\/\/)?[URL unfurl="true"]www.(.*?)$/i";[/URL]
if(1 == preg_match($pattern, $_SERVER['REQUEST_URI'], $matches)):
header ('HTTP/1.1 301 Moved Permanently');
header ('Location: [URL unfurl="true"]http://www.'[/URL] . $matches[2]);
die();
endif;
RewriteCond %{HTTP_HOST} !^$
RewriteCond %{HTTP_HOST} !^[URL unfurl="true"]www\.[/URL] [NC]
RewriteCond %{HTTPS}s ^on(s)|
RewriteRule ^ http%1://[URL unfurl="true"]www.%{HTTP_HOST}%{REQUEST_URI}[/URL] [R=301,L]
Surprising little mistake from Justin.zoldos said:The first method didn't work, but the second one works great! Thanks so much!!
php.net said:'REQUEST_URI'
[ ] [ ] The URI which was given in order to access this page; for instance, '/index.html'.
[b]if[/b] [teal]([/teal][COLOR=darkgoldenrod]substr[/color][teal]([/teal][navy]$_SERVER[/navy][teal][[/teal][green][i]'HTTP_HOST'[/i][/green][teal]],[/teal] [purple]0[/purple][teal],[/teal] [purple]4[/purple][teal])[/teal] [teal]!=[/teal] [green][i]'www.'[/i][/green][teal])):[/teal]
[COLOR=darkgoldenrod]header[/color][teal]([/teal][green][i]'HTTP/1.1 301 Moved Permanently'[/i][/green][teal]);[/teal]
[COLOR=darkgoldenrod]header[/color][teal]([/teal][green][i]'Location: [URL unfurl="true"]http://www.'[/URL][/i][/green] [teal].[/teal] [navy]$_SERVER[/navy][teal][[/teal][green][i]'HTTP_HOST'[/i][/green][teal]][/teal] [teal].[/teal] [navy]$_SERVER[/navy][teal][[/teal][green][i]'REQUEST_URI'[/i][/green][teal]]);[/teal]
[b]die[/b][teal]();[/teal]
[b]endif[/b][teal];[/teal]
<IfModule mod_php5.c>
php_value auto_prepend_file "path/to/file.php"
</IfModule>
[/code[