#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] |
Hello,
I hope i can finally get help over here.
i want to forward all request from old path to new path and retaining the method and queries.
OLD URL PATH:
[POST|GET|PUT|DELETE]: mydomain.com/public/api?key=value
Desired URL PATH:
[POST|GET|PUT|DELETE]: mydomain.com/api?key=value
Please can any one help me with the .htaccess
code to achieve above idea.
HI I'm having troubles making a redirection, and maybe you can help me.
I have two domains in the same VPS: domainOne.com and domainTwo.com. I want to redirect every user that navigates to domainTwo.com to domainOne.com, and I have this redirection (in domainTwo.com) that works perfectly fine:
Redirect 301 / https://domainOne.com/
But now I'd like to redirect everything, except the main/home of domainTwo. I mean, I will have a landing page (index.html) on domainTwo root and I one to keep it, but redirect anything else.
Thank you!
When Redirect with htaccess to link the browser show ?url= in the last of link
RewriteEngine on
Redirect /elitehomespro/projects/Real-estate-for-sale-in-the-center-of-Istanbul-with-high-investment-advantages https://www.almsoty.com/5-Best-Discord-Bots-for-Your-Business
RewriteRule ^projects/([a-zA-Z0-9-أ-ا-آ-ب-ت-ث-ج-ح-خ-د-ذ-ر-ز-س-ش-ص-ض-ط-ظ-ع-غ-ف-ق-ك-ل-م-ن-ه-و-ي/]+)$ project.php?url=$1 [NC,L]
Thanks for the example. I'm trying to implement it, but there is a weird problem I have.
https://vegan4k.com/index.html - This page shows 404 and it doesn't want to redirect to the homepage and I don't understand how to make it work.
I'm trying to add smth like:
RewriteEngine On
RewriteBase /
RewriteRule ^index.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
But it shows 500 error. Can anybody help? Thanks!
Hi, I need help because I am struggling with redirecting a broken link to my website page/url.
Please guide me how can i redirect this url: https://softlay.net/graphics-design/...rdu-fonts.html
To this: https://www.softlay.com/downloads/500-urdu-fonts
I am redirecting my entire old site (.net TLD) to new domain (.com TLD) and preserving url paths.
I think my problem is due to the URL having unsupported file extension (i.e "...rdu-fonts.html" instead of ".html")
I have tried "Redirect a single page" and "Redirect any file with the ...rdu-fonts.html extension" code snippets.
I hope someone may be able to help me. Thanks.
Please help me as I'm having trouble redirecting a broken hyperlink to my site's page/url. https://www.avoid.uk.net/windows-11-download-iso/
Hello,
i changed my hosting from nginx to apache.
before i had my own cdn and cdn.domain.com are redirected to domain.com.
i try a few .htaccess redirects but always it ending with a redirect loop.
the cdn root is pointed to the main root.
is there a way to redirect the cdn.domain.com to domain.com?
thank you in advance
I don't want to manually redirect all addresses to this format .
I want all address /amp are
be guided backwards
Redirect /air/amp /air
Thank you for this guide information, now I can redetect site https://relaxmodapk.com/ without any plugins, Thanks sir.
I appreciate the information listed in this guide and will have no problem reidentifying https://queenapk.com/ without any plugins.
Thank you for this guide information, now I can redetect site https://apkzar.com/ without any plugins, Thanks sir.
HOPE YOU HELP
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
A very excellent blog post.Thank you so much for such a well-written article. Slope Unblocked
That my fella, is the wrong solution for my idea.
Not to be followed, good practice is a comment above that.