Redirect /web url to / Symfony - .htaccess

My website is build with Symfony3.
I'm in front on a problem .
mywebsite.com/contact
is also accessible as
mywebsite.com/web/contact
I want to redirect all urls like mywebsite.com/web/something to mywebsite.com/something
Is it possible?

You have wrong configruation of your RootFolder, you need to setup your virtual hosts correctly

Related

.htaccess redirect old domain to new domain

I use from http://siteold.com/json/ in my application and can not change it.
and my new domain is http://panel.sitenew.com/json/ . how redirect my old url to new url without change in application ?
this way does not work (in siteold.com) :
RewriteEngine On
Redirect http://siteold.com/json/ http://http://panel.sitenew.com/json/
I don't think it is possible to redirect a URL to another URL. You will have to create a htaccess.txt file to the directory of the website you want to redirect, and then use this code
Redirect /siteold.com/json/ http://panel.sitenew.com/json/
This will redirect the old file path to the new file path. You cannot add http:// to the origin domain as the code doesn't work like that.
Source

Nginx .htaccess doesn't work in linux server

hi everyone i have just created website to myself and i editted links using .htaccess (111.111.111.111/list.php | like 111.111.111.111/list ) not include php extension. but when i put files into my linux server, it doesn't work my linux nginx server. when i write 111.111.111.111/list on the url box, it display 404 not found page. it wants to me write 111.111.111.111/list.php
and everything is working on my computer localhost. (i didnt buy domain name i just use only server's ip) please help me
by the way i apologize for my english.
Nginx does not support .htaccess-files because of performance reasons.
https://www.nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/
You have to do this inside of the nginx configuration file.
To remove the .php maybe this helps:
How to remove both .php and .html extensions from url using NGINX?
If you really need .htaccess, you have to use apache instead of nginx.

Redirect custom URLs via htaccess

I have my own domain:
http://cesarferreira.com
and I wanna make
http://cesarferreira.com/github
point to
https://github.com/cesarferreira
Without having to make a /github/ folder with an index.html with a redirect for each page I own (facebook, twitter, pinterest, etc)
Is there a way like for example htaccess catchig *.com/github and pointing to a given static url?
Thanks a lot
If your document root serves -
http://cesarferreira.com
you can put a redirect in .htaccess like -
Redirect /github https://github.com/cesarferreira
Take a look at URL rewriter 'http://httpd.apache.org/docs/2.0/misc/rewriteguide.html'. That should be able to do everything you want and more.
As long as it is enabled in apache then you can use it in .htaccess files also.
You can use mod_alias:
Redirect 301 /github https://github.com/cesarferreira
Or if you only want github to point only to the folder:
RedirectMatch 301 ^/github https://github.com/cesarferreira
You can put that in the htaccess file of your document root.

Use htaccess to rewrite folder.domain.com to www.domain.com/folder

I want to set up a blog on my current domain at
http://www.ashrobbins.com/folder/
and use htaccess so that it can be reached by simply going to
http://folder.ashrobbins.com
The rewrite I currently have in my .htaccess is below.
RewriteRule ^blog$ blog.php [L,NC]
But I get a page not found when I go to folder.ashrobbins.com in my browser...
You must setup ashrobbins.com in your host to serve content from a local folder, and add a 'folder' folder inside it.
And also setup folder.ashrobbins.com in your host to serve content from another local folder. As I can see, you haven't setup folder.ashrobbins.com nd therefore you receive that error.
It seems you are creating a new site and doesn't know how to do it. If it's new, just setup subdomain.ashrobbins.com and put your site on it. If there's nothing already served in ashrobbins.com/folder/ just don't mess with it.

yii, Development and URL issues

We have our server which runs the site at 173......54/
For development we want to have a copy of the code that can be tested at 173.....54/~me/site
When I install a copy of Yii and the code at ~me/ folder and access 173.....54/~me/site I am able
to see the newly installed index html. However, if I try to move to 173.....54/~me/site/book or a user register page or any other page the other (main) Yii application reads the code as a link not found instead of the development Yii application.
Am I supposed to update a the htaccess file to ignore requests within /~me ? If so how should it look? Or am I missing something?
Thanks again!
No need to make ignore in other .htaccess, the dev site .htaccess will take care of it.
In your index.php at the root of your dev site you need to point $yii at your Yii framework/yii.php
and then in the .htaccess in the root of your dev site you need to point RewriteBase to your dev site root.
Also make sure you point to the correct configuration file corresponding with your application in index.php

Resources