Help with .htaccess file |
For a list of all requirements and guidelines pertaining to posting a new Help topic, please click here.
This Month's Contests | Staff Member of the Month | Hosts Looking for Hostees | Hostees looking for Hosts | BigBookofResources
Submission Guidelines
Help with .htaccess file |
May 17 2010, 05:07 PM
Post
#1
|
|
![]() Senior Member ![]() ![]() ![]() ![]() ![]() ![]() Group: Administrator Posts: 2,648 Joined: Apr 2008 Member No: 639,265 |
I have a website at www.monkey-robot.com/. It's a blog. All my blog files are stored in a /blog subdirectory. Internally, I rewrite the root URL to /blog, which means that when you go to www.monkey-robot.com/ you get the contents of /blog, but through the magic of Apache you don't see the URL change.
That works. What's annoying is that www.monkey-robot.com/blog also shows the front page of the blog, which means the front page exists at 2 different URLs. This is bad. So I want to redirect www.monkey-robot.com/blog to the root URL. This is my current .htaccess file for doing so: CODE ErrorDocument 403 /404.html ErrorDocument 404 /404.html Options -Indexes #### Rewrite Rules #### RewriteEngine On # Rewrite monkey-robot.com to www.monkey-robot.com RewriteCond %{HTTP_HOST} ^monkey-robot\.com$ RewriteRule ^(.*)$ http://www.monkey-robot.com/$1 [R=301,L] RewriteRule ^$ /blog/ [L] RewriteRule ^feeds/blog/?$ /feeds/blog/atom.xml [L] Right after the RewriteRule ^$ /blog/ [L], I tried adding this: CODE RewriteRule ^blog/?$ / [R,L] But that gave me an error with "infinite redirects", probably because of the line before it (even though I thought it shouldn't). So I did this instead: CODE RewriteRule ^blog/?$ http://www.monkey-robot.com/ [R,L] But then I got the following Apache error: Invalid command '[R,L]', perhaps misspelled or defined by a module not included in the server configuration But I'm pretty sure the syntax is correct. Any ideas? |
|
|
|
mipadi Help with .htaccess file May 17 2010, 05:07 PM
fixtatik Did you write it as "RewriteRull", or wa... May 17 2010, 08:56 PM
mipadi Typo. May 17 2010, 08:57 PM
fixtatik Apache always gives me a headache. I'd always ... May 17 2010, 09:15 PM
mipadi QUOTE(fixtatik @ May 17 2010, 10:15 PM) S... May 17 2010, 09:34 PM
barrykins I probably don't get your question but why don... May 19 2010, 01:14 PM
mipadi QUOTE(barrykins @ May 19 2010, 02:14 PM) ... May 19 2010, 01:18 PM
barrykins Well as Im reading, I might be wrong but.. Couldn... May 19 2010, 01:25 PM
mipadi QUOTE(barrykins @ May 19 2010, 02:25 PM) ... May 19 2010, 01:29 PM
barrykins Ohh see yup. I misunderstood the question. May 19 2010, 01:38 PM
randycowell In general, you should never use .htaccess files u... Jun 7 2010, 07:38 AM
mipadi QUOTE(randycowell @ Jun 7 2010, 08:38 AM)... Jun 7 2010, 09:59 AM
randycowell The .htaccess files should not be used when there... Jun 9 2010, 06:54 AM
Mikeplyts ^ A boatload of people already do even without ... Jun 9 2010, 09:35 AM
mipadi QUOTE(randycowell @ Jun 9 2010, 07:54 AM)... Jun 9 2010, 11:11 AM![]() ![]() |