How to redirect this
https://www.example.com/watch?v=ilTNJoSgeF8
to this
http://www.example.com/#/watch/ilTNJoSgeF8
so it just need to change this /watch?v= into this /#/watch/
Using mod_rewrite, you can do something like this in the htaccess file in your document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^v=([^&]+)
RewriteRule ^watch$ /#/watch/%1? [L,NE,R]
Related
How could I redirect the following URL from my site to an other website (URL wth parameters too) using the .htaccess?
Example:
Redirect
http://mysite.com.br/page/?r=17dzhZ3JG5jfKMd45BowS1Pr1cH9FW8zzK
to
http://anothersite.com.br/?r=1vEe4mDd94JQLCCTnX3Cdzy2KFfH6eKbS
In the htaccess file on mysite.com.br's document root:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^r=17dzhZ3JG5jfKMd45BowS1Pr1cH9FW8zzK$
RewriteRule ^page/?$ http://anothersite.com.br/?r=1vEe4mDd94JQLCCTnX3Cdzy2KFfH6eKbS [L,R]
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]
I have a big list of duplicate urls and i need to do some redirect
Example
www.mysite.com/mypage/name2_68.html
www.mysite.com/jjj/name2_68.html
www.mysite.com/aa/name2_68.html
www.mysite.com/5654/name2_68.html
www.mysite.com/mypage/myname87.html
www.mysite.com/6584/myname87.html
www.mysite.com/any-number/myname87.html
www.mysite.com/any_word/myname87.html
All i need to do is to redirect them to
www.mysite.com/mypage/myname87.html
www.mysite.com/mypage/name2_68.html
So all url with
www.mysite.com/anycharactere/example1.html
Will be redirect to
www.mysite.com/mypage/example1.html
This should work.
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/mypage/?
RewriteRule ^[^/]+/(.*\.html?)$ /mypage/$1 [R=301,L]
Put it in your .htaccess
RewriteEngine On
RewriteRule .*/([^/]+.html)$ /mypage/$1
i want to create with htaccess that if you go to www.website1.com/page.php that you go to www.website2.com/page.php, and www.website1.com/foo/bar/index.php to www.website2.com/foo/bar/index.php redirects. How can i do that with htaccess? Example please.
If mod_rewrite is available, you can put this code into the .htaccess of www.website1.com:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?website1\.com$
RewriteRule ^(.*)$ http://www.website2.com/$1 [L,QSA,R=301]
This would redirect every page on website1.com to the equivalent on website2.com
How to redirect the url using .htaccess?
Actual url is www.mywebsite.com/index.php/user/john
is need to convert as john.mywebsite.com/
Try this code in .htaccess:
Options +FollowSymLinks
RewriteEngine on
RewriteEngine On
RewriteRule ^index.php/(.*)/(.*) $2.mywebsite.com/
If you have wildcard Dns, contact your host provider/adminisrator. And request to the line
*.yourdomain.com on server configuration file.
You can write your self on your htaccess file as following,
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.yourdomain.com
RewriteCond %{HTTP_HOST} ([^.]+)\.yourdomain.com
RewriteRule ^(.*)$ /path_to_your_site/subdoamin.php?url=%1