FREE THOUGHT · FREE SOFTWARE · FREE WORLD

SEO Redirects without mod_rewrite

Web Professionals use mod_rewrite to issue 301 and 302 Redirects for Search Engines. Sometimes you may not have mod_rewrite.c or you want an alternative redirect method. Using mod_alias RedirectMatch you can use REGEX in Redirect commands!


SEO Search Engine Friendly Redirects without mod_rewrite

SEO 301 Redirect Single File

Redirect 301 /d/file.html /ddd/file.html

Redirect Home to new Domain

Redirect 301 / http://www.htaccesselite.com

301 Redirect multiple files

RedirectMatch 301 /blog(.*) /$1

Redirect Entire site to single file

Note: This is a 302 (temporary)redirect because its meant to point to a temporarily offline file.

RedirectMatch 302 ^/ /temporary-offline.html

Putting it all together

301 and 302 Redirects

Redirect 301 /security/rigging-the-dreamhost-site-of-the-month-contest.html https://www.askapache.com/dreamhost/rigging-the-dreamhost-site-of-the-month-contest/
Redirect 301 /htaccess/speed-up-the-apache-web-server-with-configuration-hacks.html https://www.askapache.com/htaccess/apache-web-server-speed-configuration-hacks/
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html https://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost/
Redirect 301 /2007/phpbb/sending-post-form-data-with-php-curl.html https://www.askapache.com/htaccess/sending-post-form-data-with-php-curl/
Redirect 301 /htaccess.txt /wp-content/uploads/p/htaccess.txt
Redirect 301 /2007/webmaster/php-and-ajax-shell-console.html https://www.askapache.com/tools/php-and-ajax-shell-console/
Redirect 301 /2007/webmaster/custom-phpini-with-fastcgi-on-dreamhost.html https://www.askapache.com/dreamhost/custom-phpini-with-fastcgi-on-dreamhost/
Redirect 301 /seo/tailrankcom-robot.html https://www.askapache.com/seo/tailrank-robot/
Redirect 301 /instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html https://www.askapache.com/htaccess/503-service-temporarily-unavailable/
Redirect 301 /htaccess/instruct-search-engines-to-come-back-to-site-after-you-finish-working-on-it.html https://www.askapache.com/htaccess/503-service-temporarily-unavailable/
Redirect 301 /webmaster/lft-traceroute-tool.html https://www.askapache.com/tools/lft-traceroute-tool/
# 302 Temporary
Redirect 302 /apachesearch/ http://google.com/coop/cse?cx=002660089121042511758%3Akk7rwc2gx0i

RedirectMatch with wildcards

RedirectMatch 301 ^/wp-content/uploads/p/(.*)$ https://www.askapache.com/s/s.askapache.net/p/$1
RedirectMatch 301 ^/(.*)htaccess.html/2/(.*)$ https://www.askapache.com/htaccess/using-http-headers-with-htaccess/$2
RedirectMatch 301 ^/(.*)htaccess.html/3/(.*)$ https://www.askapache.com/htaccess/php-htaccess-tips-and-tricks/$2
RedirectMatch 301 ^/(.*)htaccess.html/4/(.*)$ https://www.askapache.com/htaccess/seo-search-engine-friendly-redirects-without-mod_rewrite/$2
RedirectMatch 301 ^/(.*)htaccess.html/5/(.*)$ https://www.askapache.com/htaccess/modrewrite-tips-tricks/$2
RedirectMatch 301 ^/(.*)htaccess.html/6/(.*)$ https://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control/$2
RedirectMatch 301 ^/(.*)htaccess.html/7/(.*)$ https://www.askapache.com/htaccess/apache-authentication-in-htaccess/$2
RedirectMatch 301 ^/(.*)htaccess.html/8/(.*)$ https://www.askapache.com/htaccess/security-with-htaccess/$2
RedirectMatch 301 ^/(.*)htaccess.html/9/(.*)$ https://www.askapache.com/htaccess/ssl-example-usage-in-htaccess/$2
RedirectMatch 301 ^/(.*)htaccess.html/10/#htaccess-glossary https://www.askapache.com/htaccess/htaccess-for-webmasters/#htaccess-glossary
RedirectMatch 301 ^/(.*)htaccess.html/10/(.*)$ https://www.askapache.com/htaccess/apache-variable-fun-in-htaccess/$2
RedirectMatch 301 ^/(.*).htm$ https://www.askapache.com/$1.html
RedirectMatch 301 ^/200([0-9])/([^01])(.*)$ https://www.askapache.com/$2$3
RedirectMatch 301 ^/(.*)/htaccesselite-ultimate-htaccess-article.html(.*) https://www.askapache.com/htaccess/
RedirectMatch 301 ^/(.*).html/1/(.*) https://www.askapache.com/$1.html$2
RedirectMatch 301 ^/category/(.+)$ https://www.askapache.com/$1

Redirecting To Trigger Errors

Redirect 400 /seo/400
Redirect 401 /seo/401
Redirect 402 /seo/402
Redirect 403 /seo/403
Redirect 404 /index.php?error=404
Redirect 405 /seo/405
Redirect 406 /seo/406
Redirect 407 /seo/407
Redirect 408 /seo/408
Redirect 409 /seo/409
Redirect 410 /seo/410
Redirect 411 /seo/411
Redirect 412 /seo/412
Redirect 413 /seo/413
Redirect 414 /seo/414
Redirect 415 /seo/415
Redirect 416 /seo/416
Redirect 417 /seo/417
Redirect 418 /seo/418
Redirect 419 /seo/419
Redirect 420 /seo/420
Redirect 421 /seo/421
Redirect 422 /seo/422
Redirect 423 /seo/423
Redirect 424 /seo/424
Redirect 425 /seo/425
Redirect 426 /seo/426
Redirect 500 /seo/500
Redirect 501 /seo/501
Redirect 502 /seo/502
Redirect 503 /seo/503
Redirect 504 /seo/504
Redirect 505 /seo/505
Redirect 506 /seo/506
Redirect 507 /seo/507
Redirect 508 /seo/508
Redirect 509 /seo/509
Redirect 510 /seo/510

Redirecting using the following directives is done using the module mod_alias. RedirectMatch, RedirectPermanent, RedirectTemp, Redirect


htaccess Guide Sections

| .htaccess Tutorial Index |


Htaccess 301 Redirect SEO

 

 

Comments