Change url address in htaccess - .htaccess

I would like to redirect this address:
mysite.com/reports/flight?pay=888&invoice=321
to this one:
mysite.com/reports/#!/flight?pay=888&invoice=321
How can I do it?

Related

Redirect entire site to other url with htaccess

I have a site which you can access with or without https rule. So, I need to make a redirect to another page. Example:
My website is: www.google.com so I can access by the moment as https://www.google.com and http://www.google.com but I need when you get into my website trough http or https way you must have to redirect to www.yahoo.com.
Besides I need the url redirection too to any subdomain or url which exists in http://www.google.com or https://www.google.com
How can I do this? I have no found alredy information about it in S.O. Thanks.
Very simple. You can use the following Redirect in your htaccess to redirect all requests from your site to the other domain
RedirectMatch 301 / http://yahoo.com/

Redirect Old URL to New URL open cart using htaccess

I want to redirect 301 old url to new url.
my old url is;
http://www.domainname.com/special
and new url is;
http://www.domainname.com/offers
I tried this code:
redirect 301 /http://www.domainname.com/special http://www.domainname.com/offers
But still now it's not redirecting & taking me to the old URL which does'nt exist.
Try this :
Redirect 301 /special /offers
Second argument of Redirect Directive is the URL Path, it doesn't start with Scheme and hostname.
There are various ways to do this and various redirects, I've listed them below:
301 (Permanent) Redirect: Point an entire site to a different URL on a permanent basis. This is the most common type of redirect and is useful in most situations. In this example, we are redirecting to the "example.com" domain:
This allows you to redirect your entire website to any other domain
Redirect 301 / http://example.com/
302 (Temporary) Redirect: Point an entire site to a different temporary URL. This is useful for SEO purposes when you have a temporary landing page and plan to switch back to your main landing page at a later date:
This allows you to redirect your entire website to any other domain
Redirect 302 / http://example.com/
Redirect index.html to a specific subfolder:
This allows you to redirect index.html to a specific subfolder
Redirect /index.html http://example.com/newdirectory/
Redirect an old file to a new file path:
Redirect old file path to new file path
Redirect /olddirectory/oldfile.html http://example.com/newdirectory/newfile.html
Redirect to a specific index page:
Provide Specific Index Page (Set the default handler)
DirectoryIndex index.html

.htaccess - redirect if no subdomain and pass the wrong subdomain name to another page

I want to make the a redirect on .htaccess if someone put a wrong subdomain (that doesn't exist) and pass this subdomain phraze to the another page:
BAD SUBDOMAIN:
ABC.example.org
REDIRECTION:
my-page.com?validate=ABC
How can I do this?
Your subdomain must be resolved by a DNS server and if it is wrong(that doesn't exists) the browser will display error that can't find server. So, browser can't connect your server and how can .htaccess file work?

How can I set the RewriteModule in .htaccess?

I will present a to the point example.
I have a domain name as: www.abc.com
And another domain name as: www.123.com
Now i want to write a rewritemodule in .htaccess for the following case:
If i request a url like: www.123.com/xyz
It will redirect my request to www.abc.com/track/index.php?ext=xyz
Also please tell me on which directory i should keep that .htaccess file.
Thanks.
In the root folder of www.123.com, you would create an htaccess file with the following line:
RedirectMatch 301 (.*) www.abc.com/track/index.php?ext=$1
Since you are doing an external redirect, it is not necessary to use mod_rewrite.

Default Page Display in Address Bar using .htaccess

I wanted a htaccess file which would set the Default page for a directory and also display the file name in the address bar.
For example:
In general, if index.html is the Index file, then typing the address http://www.example.com/ would be internally loading http://www.example.com/index.html but by default the /index.html is not displayed in the address bar. How can we display it.
Like if user enters http://www.example.com then the address should change to http://www.example.com/index.html
Please Help
Thanks
Redirect from www.example.com to www.example.com/index.html, using mod_rewrite.

Resources