How to change the route in HTACCESS - .htaccess

I have a web route problem in which one is badly located and I want to change it or redirect the one I want with the .htaccess file of my web page. Try creating a RewriteRule but it did not work. Could you help me?
Erroneous route: mysite.com/swf/c_images/navigator-thumbnail/foto.jpg Route that I want you to address or change: mysite.com/photos/thumbnail/foto
Here is my RewriteRule
RewriteRule ^swf/c_images/navigator-thumbnail/?$ $1/photos/thumbnail$2 [R=301,L]

Check this rule in top of your .htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^swf\/c_images\/navigator-thumbnail\/(.*)\.jpg$ /photos/thumbnail/$1 [R=301,L]
</IfModule>
Rule rewrite your link
mysite.com/swf/c_images/navigator-thumbnail/foto.jpg <> mysite.com/photos/thumbnail/foto
and all jpg foto in /swf/c_images/navigator-thumbnail/ to /photos/thumbnail/
mysite.com/swf/c_images/navigator-thumbnail/any-foto.jpg <> mysite.com/photos/thumbnail/any-foto

Related

htaccess and Laravel

my domain
example.com
I want install Laravel to subfolder
example.com/my_app
when I pass the link
example.com/my_app/public - I see page "You have arrived", but I want see this page without segment "public".
I want make something like I do when I use Laravel not in subfolder, like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I edited .htaccass file in base folder (example.com) :
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} ^/my_app
RewriteRule ^(.*)/$ my_app/public/$2 [L,R=301]
</IfModule>
after this when I pass at example.com/my_app/ I redirects to example.com/my_app/public and I see page "You have arrived", but this is redirect (R=301) and if I delete flag R=301 - I see page with "Whoops, looks like something went wrong."
I am three days looking solutions in this website, but ...
tell me what am I doing wrong.
Thank.
The entry point for all requests to a Laravel application is the public/index.php.
for further info you can go to this link.
Assuming you are using Apache, You would need to configure virtual host for this as you would need to point example.com/my_app to your laravel/public/index.php. directory.

htaccess rule to redirect old blog urls to the new url

I have a Wordpress blog at the following URL:
www.example.com/Folder1/blog
I want to move it up one folder to:
www.example.com/blog
After moving all Wordpress files, I want to write a .htaccess rule that will redirect ALL my old links to the new ones automatically, like:
www.example.com/Folder1/blog/article-one
to
www.example.com/blog/article-one
I've tried a lot of .htaccess rules, but none of them worked. Can someone help?
Inside /Folder1/.htaccess place this rule:
RewriteEngine On
RewriteRule ^(.*)$ /$1 [R=302,L,NE]
Try this sample code:
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^folder1.*$ http://example.com/folder2/ [R=301,L]
source

.htaccess forward from one domain to a specific .html page

I know how to use .htaccess to forward everything in one domain to a new domain name. But in this case, I want everything from one domain to go to a specific .html page on a different domain. That's where I'm lost. I'm trying the following but it just redirects to a folder and the page in question is in that folder but obviously, I don't want people seeing the contents of that folder. Make any sense? So example.com needs to go to yyy.com/some-page.html
This is what I'm currently using:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (www\.)?5\.xxxx\.com [NC]
RewriteRule ^(.*)$ http://www.1.yyy.com/$1 [R=301,L]
Try:
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} (www\.)?5\.xxxx\.com [NC]
RewriteRule .* http://www.1.yyy.com/some-page.html [R,L]
You can also put a blank index.html page to the directory in question to mask its contents or
you can put index.php file with this code <? header ("location: http://www.1.yyy.com/some-page.html"); ?> that will redirect a user to the desired page.
$1 is a place holder for the 1st pattern match. So if you are rewriting domaina.com/someurl/, it is attempting to load domainb.com/someurl/. Swap the $1 with the actual page --- e.g. somepage.html and it should work. But unless both of these domains are pointing to the same files/directories, the rule seems a bit overcomplicated.
So how about just a simple redirect?
Try this in your .htaccess file.
redirect 301 / http://somesite.com/somepage.html
OR you can try this.
RewriteRule ^(.*)$ http://somesite.com/somepage.html [R=301,L]
It does work and you can test my RewriteRule below.
http://htaccess.madewithlove.be/
There must be something else going on.

Redirecting Subdomain to Subfolder

I try to add the following logic to a .htaccess file:
subdomain.domain.xx make a redirect to subdomain.domain.xx/subdomain/
xy.domain.xy redirect to xy.domain.xy/xy/ (it should work with every subdomain without adding new rewrites)
i found a lot of solutions to redirect subdomain.domain.xx -> domain.xx/subdomain, but nothing like i need... below you find the code i try out.
Hope someone can help me. Thanks.
RewriteEngine on
RewriteBase /
RewriteRule ^([^.?]+[^.?/])$ $1/ [R]
RewriteCond %{HTTP_HOST} ^(www)?.domain.ch/$
RewriteRule .* http\://%1$1.domain.ch/%1$1 [I,R=301]
Place this in the .htaccess file of your subdomain's root directory:
DirectoryIndex index.html
RewriteEngine on
Redirect permanent /index.html http://subdomain.domain.xx/subdomain/

How to redirect a single web page from one domain to another using .htaccess

How do I get the following redirect to work?
olddomain.com/employee-scheduling-software.html
To redirect to
newdomain.us/employee-scheduling-software.html
I do have mod_rewrite on, but I'm basically a complete novice in this area
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^employee-scheduling-software.html$ http://newdomain.example.org/employee-scheduling-software.html
</IfModule>
You can change the rule into:
RewriteRule ^employee-scheduling-software.html$ http://newdomain.example.org/employee-scheduling-software.html [R=301]
which will send a 301 Moved Permanently header to the browser, so it updates its bookmarks and stuff.
You could use this code in .htaccess on olddomain.com:
RewriteEngine on
RewriteRule ^employee-scheduling-software\.html$ http://newdomain.us/employee-scheduling-software.html [R,QSA]
Since the ^employee-scheduling-software\.html$ is a PERL regex, you need to escape the dot in ".html" with a backslash (\.).
This will just redirect employee-scheduling-software.html to the new domain. If you want to redirect all files to the new domain, use:
RewriteEngine on
RewriteRule ^(.*)$ http://newdomain.us/$1 [R,QSA]

Resources