Forum Moderators: phranque
anyway, here's the content of my .htaccess file located in public_html folder:
# Turn on rewrites.
RewriteEngine on# Only apply to URLs on this domain
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$# Only apply to URLs that aren't already under folder.
RewriteCond %{REQUEST_URI} !^/subdirectory/# Don't apply to URLs that go to existing files or folders.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d# Rewrite all those to insert /folder.
RewriteRule ^(.*)$ /subdirectory/$1# Also redirect the root folder.
RewriteCond %{HTTP_HOST} ^(www.)?mysite.com$
RewriteRule ^(/)?$ /subdirectory/index.php [L]
this helped solved my initial problem of redirecting my domain name to my subdirectory. if you type in the address bar, www.mysite.com, it indeed redirects to my subdirectory and the address bar only shows www.mysite.com. but when i start clicking on links on my site, for example, if i go to the contact page, then the address bar changes to www.mysite.com/subdirectory/contact
how can i avoid this from happening? please please help me!
thanks in advance! =)
What do the links on your pages look like when you view page source? -- <a href= what?
i viewed page source, and for some reason, the links are <a href=http://mysite.com/subdirectory/pagelink>
i didnt manually code it so i dont know how that happened. i used to have my site files in the root directory (public_html) but i decided to move everything to a subdirectory instead coz its such a mess looking at my files scattered in the public_html folder, as i have lots of subdomains.
so pls tell me how i can go about doing this.
thanks!
I also note that you refer to your site as "www.domain.com" while you say the links are to "domain.com". Therefore, you may also have a domain canonicalization problem. Pick www or non-www, 301-redirect the non-preferred version to the preferred version, and make sure that all links on your site consistently refer to the preferred version. This avoids duplicate-content problems which can split your page's PageRank/Link-popularity in two, and cause a search ranking loss.
Jim
alright how about if we put it this way. those codes i quoted above for the .htaccess rewrite, i just got them from another article. by default, my .htaccess file doesnt have anything in it, totally empty. so let's say i empty that again, how can i point my domain.com to one of my subdirectories with the url not showing the subdirectory?
That is, what you have in your .htaccess file works properly as far as it goes, but you have another problem with the configuration or code of whatever it is that creates the links on your pages.
Jim