Welcome Guest, Not a member yet? Register   Sign In
SEO URIs and .htaccess Problem
#1

[eluser]bradcis[/eluser]
I am developing one of my first websites on the CodeIgniter problem and keep running into a problem. For SEO purposes, I am forcing the "www" subdomain on all webpages within CI. I also am attempting to remove the "/index.php/" portion.

My .htaccess file looks like this:
Code:
RewriteEngine on
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]

RewriteCond $1 !^(index\.php|images|includes|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

What is happening is that it does indeed force the "www" subdomain, but no matter what page I go to /about/, /contact/, etc., the only page that is displayed is the front page. (in this case it is defaulted to /home/).

Additionally, in the config.php file, I set $config['index_page'] = "";


Any help would be greatly appreciated.
#2

[eluser]TheFuzzy0ne[/eluser]
I'm no expert with .htaccess files, but I'd try this:
Code:
RewriteEngine on
Options +FollowSymlinks

RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

RewriteCond $1 !^(index\.php|images|includes|user_guide|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
#3

[eluser]bradcis[/eluser]
I just tried this. While the www. redirect still works, pages still wont load other than the default.
#4

[eluser]TheFuzzy0ne[/eluser]
First of all, you might want to change the value of $config['uri_protocol']. There's a short list of available protocols there, but sometimes AUTO doesn't work. I'd suggest working through them each. Sometimes you'll find that 'QUERY_STRING' works. If none of those work, try changing the last line of your .htaccess file to any one of the following:

Code:
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteRule ^(.*)$ /index.php?$1 [L]
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteRule ^(.*)$ index.php?$1 [L]

In theory, the third one in the list is most likely to work.
#5

[eluser]bradcis[/eluser]
The third in the list did indeed work perfectly. Thanks for all of your help =)




Theme © iAndrew 2016 - Forum software by © MyBB