#301 Redirects for .htaccess | |
#Redirect a single page: | |
Redirect 301 /pagename.php http://www.domain.com/pagename.html | |
#Redirect an entire site: | |
Redirect 301 / http://www.domain.com/ | |
#Redirect an entire site to a sub folder | |
Redirect 301 / http://www.domain.com/subfolder/ | |
#Redirect a sub folder to another site | |
Redirect 301 /subfolder http://www.domain.com/ | |
#This will redirect any file with the .html extension to use the same filename but use the .php extension instead. | |
RedirectMatch 301 (.*)\.html$ http://www.domain.com$1.php | |
## | |
#You can also perform 301 redirects using rewriting via .htaccess. | |
## | |
#Redirect from old domain to new domain | |
RewriteEngine on | |
RewriteBase / | |
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] | |
#Redirect to www location | |
RewriteEngine on | |
RewriteBase / | |
rewritecond %{http_host} ^domain.com [nc] | |
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,nc] | |
#Redirect to www location with subdirectory | |
RewriteEngine on | |
RewriteBase / | |
RewriteCond %{HTTP_HOST} domain.com [NC] | |
RewriteRule ^(.*)$ http://www.domain.com/directory/index.html [R=301,NC] | |
#Redirect from old domain to new domain with full path and query string: | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteRule ^(.*) http://www.newdomain.com%{REQUEST_URI} [R=302,NC] | |
#Redirect from old domain with subdirectory to new domain w/o subdirectory including full path and query string: | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI} ^/subdirname/(.*)$ | |
RewriteRule ^(.*) http://www.katcode.com/%1 [R=302,NC] | |
Rewrite and redirect URLs with query parameters (files placed in root directory) | |
Original URL: | |
http://www.example.com/index.php?id=1 | |
Desired destination URL: | |
http://www.example.com/path-to-new-location/ | |
.htaccess syntax: | |
RewriteEngine on | |
RewriteCond %{QUERY_STRING} id=1 | |
RewriteRule ^index\.php$ /path-to-new-location/? [L,R=301] | |
Redirect URLs with query parameters (files placed in subdirectory) | |
Original URL: | |
http://www.example.com/sub-dir/index.php?id=1 | |
Desired destination URL: | |
http://www.example.com/path-to-new-location/ | |
.htaccess syntax: | |
RewriteEngine on | |
RewriteCond %{QUERY_STRING} id=1 | |
RewriteRule ^sub-dir/index\.php$ /path-to-new-location/? [L,R=301] | |
Redirect one clean URL to a new clean URL | |
Original URL: | |
http://www.example.com/old-page/ | |
Desired destination URL: | |
http://www.example.com/new-page/ | |
.htaccess syntax: | |
RewriteEngine On | |
RewriteRule ^old-page/?$ $1/new-page$2 [R=301,L] | |
Rewrite and redirect URLs with query parameter to directory based structure, retaining query string in URL root level | |
Original URL: | |
http://www.example.com/index.php?id=100 | |
Desired destination URL: | |
http://www.example.com/100/ | |
.htaccess syntax: | |
RewriteEngine On | |
RewriteRule ^([^/d]+)/?$ index.php?id=$1 [QSA] | |
Rewrite URLs with query parameter to directory based structure, retaining query string parameter in URL subdirectory | |
Original URL: | |
http://www.example.com/index.php?category=fish | |
Desired destination URL: | |
http://www.example.com/category/fish/ | |
.htaccess syntax: | |
RewriteEngine On | |
RewriteRule ^/?category/([^/d]+)/?$ index.php?category=$1 [L,QSA] | |
Domain change – redirect all incoming request from old to new domain (retain path) | |
RewriteEngine on | |
RewriteCond %{HTTP_HOST} ^example-old\.com$ [NC] | |
RewriteRule ^(.*)$ http://www.example-new.com/$1 [R=301,L] | |
If you do not want to pass the path in the request to the new domain, change the last row to: | |
RewriteRule ^(.*)$ http://www.example-new.com/ [R=301,L] | |
#From blog.oldsite.com -> www.somewhere.com/blog/ | |
retains path and query, and eliminates xtra blog path if domain is blog.oldsite.com/blog/ | |
Options +FollowSymLinks | |
RewriteEngine On | |
RewriteCond %{REQUEST_URI}/ blog | |
RewriteRule ^(.*) http://www.somewhere.com/%{REQUEST_URI} [R=302,NC] | |
RewriteRule ^(.*) http://www.somewhere.com/blog/%{REQUEST_URI} [R=302,NC] |
Thank you for this guide information, now I can redetect site https://apkyolo.com/ without any plugins, Thanks sir.
now I can redetect site https://instamody.com/ without any plugins, Thanks sir.
now I can redetect site https://apkrog.com/ without any plugins, Thanks sir.
now I can site https://apkzar.co/ without any plugins, Thanks sir.
hello this will help youmore https://nxtvillain.com
I would like to change document root path for sites installed in subfolder of main domain:
example
www.mydomain.com/site1
www.mydomain.com/site2
www.mydomain.com/site3
when call a page on
www.mydomain.com/site1
if would like that my document root for this site point to /site1 folder and not to www.mydomain.com folder
Thank you
iBOMMA - Watch and Download ibomma Telugu movies from ibomma.com. Watch Telugu movies in an excellent quality at the smallest file size.
If you’re unsure where to find a casual mate, try Doublelist app with lots of sugar babies and independent escorts. All girls are incredibly beautiful and open to experiments with a stranger.
If you live in Berkeley, Ca., and are looking for a Berkeley moving company. Then look no further than the New Day Moving company. We are a leading Berkeley moving company and our clients are happy with our work. Call us anytime to book your schedule.
John Patrick University's School of Integrative and Functional Medicine university offers degrees & certificates in nutritional health.
It helped me a lot to redirect my website which is for download free vpn without any plugin
i have used all the redirects listed here including image expire headers https://findapkmod.com/
Download Most Mod Apk for Android ...
https://apkspicy.com/
If you want to download Kinemaster Pro, you can download it very easily from this goolge. We can also download it from play store. But we need no watermark and no ads. That’s why we prefer to download it from Google.
Thank you sir for such a valuable Information
Thanks for the information contained in this valuable Content
Ahh, Thankyou so much for the detailed article. I have implement the .htaccess on my Software Reviews & download website with the help of this article.
Thanks for this amazing information and content, I am also love to watch YouTube content but most of the time I prefer to to watch YouTube content in [YouTube Vanced](YouTube Vanced.
)Awesome, for more advanced htaccess examples see https://www.askapache.com/htaccess/
YouTube is beneficial to a user and YouTubers and people. Very useful versions were updated by this YouTube channel and complemented by the all Youtube Vanced Apk Download 2023
FMWhatsApp Apk Download Latest Version 2023 is a modified version of WhatsApp Messenger. You can download the latest version
Thank you for providing a platform for endless entertainment and educational content. You're a valuable part of our digital world. vanced youtube
Thank you so much
Sir for your supportive information and expert analysis
If you are a gamer, you must try the top best Unblocked games 66 on your school websites. Those are really helpful to play this game on your school systems. Just to try the all the games on that article. You might like those games.
Thank you very much for sharing such a nice Biography, it is very useful for me and everyone else. I'll be checking out frequently to read your new post, so it's unmissable to keep up.
To solve an issue you must research it first Fmovies
Thank you so much for the information, I like it's Free Fire game
Hi Guys Thank you so much for giving a such nice Net Worth information.
Thank you for this guide information, now I can redetect site https://apkzar.com/ without any plugins, Thanks sir.
HOPE YOU HELP