Hey,
This one is kind of easy. How could I redirect people going to:
http://site.com/blog/
To this:
http://site.com/blog/somespecificurl/
I only have one post at the moment and want it to just redirect to post using .htaccess.
Thanks!
Hey,
This one is kind of easy. How could I redirect people going to:
http://site.com/blog/
To this:
http://site.com/blog/somespecificurl/
I only have one post at the moment and want it to just redirect to post using .htaccess.
Thanks!
What you're looking for is called URL Rewriting. Here's a tutorial on how to do it:
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html
Although I'm a .NET guy, and usually do this using the ASP.NET routing engine, I think this will do what you need it to:
RewriteRule ^blog(/)?$ /blog/somespecificurl/
If don't have access to the server config, and just want to do it in HTML, you can do it this way:
(in the head of http://site.com/blog/index.html)
<meta HTTP-EQUIV="REFRESH" content="0;url=http://site.com/blog/somespecificurl/">
The 0 is the number of seconds to wait to redirect.
As long as you have mod_rewrite enabled in your Apache configuration, you can just make a .htaccess file with these contents:
RewriteEngine on
RewriteRule ^blog(/)?$ /blog/newarticle.html [R]
The RewriteEngine line is important, because it tells Apache to actually pay attention to RewriteRule commands. If RewriteEngine on is specified by default, this is unnecessary, but in many cases, it is not specified by default. The [R] means to force the URL rewrite as a new HTTP request, causing an actual full-fledged redirect (this is unnecessary, it depends on what you're looking for).
Alternatively, you could use the HTTP meta refresh, which is simpler but requires loading the page before the redirection even happens, or you could use PHP redirects if you have PHP enabled on the server. If so, try this in /blog/index.php:
<?php
header('Location: /blog/newarticle.html');
?>