#Hide Index
IndexIgnore *
#Define ErrorDoc
ErrorDocument 404 http://www.domain.com
#REDIRECTS
Redirect 301 /page.php http://domain.com
Redirect 301 /inc/page.php http://domain.com
Options +FollowSymlinks
RewriteEngine on
#Redirect all pages in a folder to a single URL
RewriteRule ^dir/(.*)$ http://domain.com/index.php [L,R=301]
#Redirect String
RewriteRule ^index.php?var1=value&var2=(.*)
what is the best possible way to redirect and rewrite url in virtual host file?
I want to make sure it is not heavy on the server.
I tried many ways on the virtualhost file but when I restart the apache it fails. I dont want to use .htaccess...
I installed Redmine and so far everything runs smoothly.
Now i want to add a rewrite rule via .htaccess in order to redirect requests from domain.tdl to www.domain.tdl.
This is approach works fine with my everyday php projects:
RewriteEngine On
RewriteBase /
# redirect all pages w/o www to www.
RewriteCond %{HTTP_HOST} !^www\.domain\.tdl$
RewriteRule ^(.*)$ http://www.domain.tdl/$1 [L,R=301]
I have to write a redirect rule for the below condition.
www.domain.com/custom.aspx?ATTR=VALUE to
www.domain.com/custom?ATTR=VALUE
How can this be achieved using the .htaccess
I have the below set of codes using on the current .htaccess file. Please also suggest where to include your code.
I am trying to redirect only my top level domain eg. domain.com to sub.domain.com.
I want to upgrade my site online, I want to show visitors maintenance page till I finish upgrade.
I tried this code
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !/maintenance.html$
RewriteCond %{REMOTE_HOST} !^888\.888\.888\.888
RewriteRule $ /maintenance.html [R=302,L]
But this code is redirecting all page to maintenance.html, for example
www.domain.com going to main
I'm trying to write a custom redirect rule for some testing purposes on 2 domains with exactly same site. The code Im useing is:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
RewriteCond %{HTTP_HOST} ^.*site1.com [NC]
RewriteRule ^(.*)$ http://www.site2.com/$1 [R=301,L]
What I want is to redirect all requests except 1.2.3.4 IP from site1 to site2.
My website is built up like the following
www.domain.com/products/catname/myproduct.php
www.domain.com/products/myproduct.php
Some files are in deeper directories. I am wanting to redirect www.domain.com/products/catname/ (for example) to a certain page. My directories do not include index files.
So I have oldwebsite.com/forums/seo-topics-here and I need to redirect to newsub.newsite.tld/seo-topics-here
Can I do this with htaccess
Does something like this work?
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.forums.mydomain.com
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]