Redirect specific page with query using htaccess - .htaccess

for example
mydomain.com/jobresultpage?what=&where=Arkansas
redirect to
yourdomain.com/jobresultpage?what=&where=Arkansas
but other page like
mydomain.com/about.html
mydomain.com/contact.html
not redirect..

Try adding the rules below to the .htaccess file located in the root directory of mydomain.com
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} mydomain\.com$ [NC]
#redirect any request for jobresult to yourdomain
RewriteRule ^jobresultpage$ http://yourdomain.com%{REQUEST_URI} [NC,L,R=301]

Related

How to setup addon domain .htaccess

I'm trying to setup a rule in the .htaccess file to allow me to add the 'something' to my website url, like this: something.mywebsite.com redirect to some subdirectory.
I have other rewrite conditions inside my .htaccess file already
Can you do this via .htaccess?
RewriteBase /
RewriteCond %{HTTP_HOST} ^subdomain.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/somesubdomain [R=301,L]

htaccess redirect subfolder

I would like to redirect the url http://intranet/trac/paradox/report/6 to http://cobra.woking/trac/paradox/report/6. trac is a subfolder and paradox is a subfolder. report/6 are params that need to be kept and may change.
In my apache doc root i have
#/opt/html/.htaccess
Redirect 301 / http://intranet/intranet
RewriteEngine On
RewriteRule ^trac/paradox/report/6$ http://cobra.woking/trac/paradox/report/6 [L,R]
I have tried the following which does not work
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^intranet$
RewriteRule (.*) http://cobra.woking/$1 [R=301,L]
RewriteCond %{HTTP_HOST} !^intranet$
RewriteRule (.*) http://cobra.woking/$1 [R=301,L]
URL i want to change is http://intranet/trac/paradox/ to http://cobra.woking/trac/paradox/. I have placed .htaccess in the /opt/html/trac/paradox/.htaccess
In the htaccess file of your intranet's document root, add this to the top of the file:
RewriteEngine On
RewriteRule ^trac/paradox/report/6$ http://cobra.woking/trac/paradox/report/6 [L,R]

Subdomain, Pagination and .htaccess

in the name of God
hi,
How i can transform this url
domain.tld/blog.php?name=username&page=2
to this one
username.domain.tld/page/2
with .htaccess?
add the following directives to .htaccess file (create it if it does not exist) in the root directory of your website (domain.tld)
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} name=([^&]+)
RewriteCond %{QUERY_STRING} page=([^&]+)
RewriteRule ^blog.php$ http://%1.domain.tld/page/%2? [R=301,L,NC]

.htaccess redirect subdomain

I want to allow the users to type
xyz.example.com
in order to reach
test.php?id=xyz
What code should I use to accomplish my goal?
Try adding the following to your htaccess file in the root directory of your example.com domain
RewriteEngine on
RewriteBase /
#if the host is anything.example.com
RewriteCond %{HTTP_HOST} ^([^\.]+)\.example\.com$ [NC]
#send all requests to test.php
RewriteRule .* test.php?id=%1 [L]

.htaccess subdomain redirect

My server is somehow configured to accept any string as a existing subdomian. This subdomains doesn't redirect, they show content instead. For example:
bla.example.com // shows the content of http://example.com
blabla.example.com // show the content of http://example.com
lorem.example.com/events/ // shows the content of http://example.com/events
So you can use "stackoverflow.example.com" and it will work.
I want to create an .htaccess rule to overwrite this behavior. I want to redirect http://*.example.com/* to http://www.example.com/*
Everything I have done so far is redirect http://example.com to http://www.example.com (wich is another behavior I want to keep)
RewriteCond %{HTTP_HOST} ^example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Thank you for your help!
Try adding the following to your htaccess file in the root folder of your domain
RewriteEngine on
RewriteBase /
#if its not www.example.com
RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
#redirect it to www.example.com
RewriteRule .* http://www.example.com%{REQUEST_URI} [R=301,L]

Resources