Working with mod-rewrite

Starting to look at getting my http://ninecrows.com base URL pointed at my landing page wordpress instance at http://ninecrows.com/landingpage (artwork to support the landing page will come later).

This looks useful

RewriteEngine On 
RewriteLog /tmp/log.txt
RewriteLogLevel 9 

I have read that this particular redirect is a bit challenging as you need to redirect the base reference but not the pages below it. I had found a sample that claimed to show how to do this (and it was a dozen or more lines of rewrite rules) but at that time I didn’t have the ubuntu server set up to mirror my sites so I was not ready to test it.

I see this to take down the whole site (not what I want but perhaps useful to know).

# the conditions are implicitly combined
# with a logical AND
RewriteCond %{REQUEST_URI} !=/alert.php
RewriteCond %{REQUEST_URI} !^[^.]*/$
RewriteRule ^(.*)$ /alert.php [R=301,L]

saw this suggested

RewriteRule ^(?:$|index\.php) /landing.html [R,L]

and this using a different module (mod_alias)

RedirectMatch 301 ^/$ /landing.html
RewriteRule ^$ /homepage/

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.