Symfony2 Homepage not under root directory - .htaccess

I'm developing an app, which has no "/" page. Instead of this, a english user should be forwarded to "/foo" and a german user should be forwarded to "/bar".
How would you solve this, with regards of performance? Are there symfony2 internal things I can do or would you use the .htaccess for this?
I'm using besimple/i18n-routing-bundle for i18n my routes.
Best
Christian

From kix: "Why not just add a controller for the / route that would always return a redirect response?"
This worked good.

Related

How to access one website from different directories in Kohana

I have big issue of how to do this.
I have a virtual host and access my project via it. I know want to redirect it to more friendly and accessible form.
What I use:
http://localhost/api/users
What I want:
http://api.mywebsite.com/users
I cannot determine if I should somehow change routes in boostrap.php or make some changes in .htaccess file (tried Redirect and RewriteRule but failed miserably). I would really welcome any kind of help on this topic.
(I am semi-begginer in programming, thanks for understanding that)
You can copy the /system/config/url.php to /application/config/url.php
pu

How to password protect nodejs application using alternative to htaccess

I have a site hosted in aws with www.domain.com with 2 sub domains test.domain.com and stage.domain.com. I am using MEAN for development, now what i want is to password protected my sub domains test.domain.com and stage.domain.com but in a similar fashion as we do in php using htaccess.
Now i personally like this htaccess approach because in this approach your code for the application will be same, authentication will be added by htaccess. Any idea how to do that in nodejs without altering application code, so that i can remove that in future if i want.
P.S. : Only hints are welcomed.
.htaccess does not alter the code because it's used by the Apache webserver.
Consider that Node.js IS your webserver, so that's where the magic happens (technically, it takes less code to add basicAuth to node than to add htaccess to apache + write the .htacess file).
Something, somewhere has to know that authentication is to be done :).
Here's the link to an easy way to do that in node :
Basic HTTP authentication with Node and Express 4

Symfony2/ get variable from subdomaine and htaccess

I using Symfony2.
What would be the best practice to get a variable from URL. I am using subdomain to get the city.
Ex: paris.website.com
how do I get Paris as variable.
I believe I need to play with Kernel and htaccess, but I haven't figured out how.
Thanks if you can put me on right tracks about that.
Cheers,
Pierre.
You should read the documentation of Symfony. One of the basis components of Symfony is the Routing that provides exactly what you need :
www.mysite.com/paris/
Using the subdomain is not the solution, but you can play with .htaccess to rewrite subdomain paris.mysite.com to www.mysite.com/paris (if web server allows it) after having configured your route in Symfony.

Redirection of profile pages in codeigniter using htaccess

i have currently my user profile pages like this
www.mysite.com/profile/sohailanwarpk and htaccess rule for this is
RewriteRule ^profile/([_0-9a-zA-Z-]+)$ /user/profile/
sohailanwarpk is the user name
i want to make links like this
www.mysite.com/sohailanwarpk
but the problem i am facing that i have other sites pages too.. like
www.mysite.com/page1
www.mysite.com/page2
so i can differentiate this or whats the best way to do this
Its better make it by routes.php
LIKE
$route['^(?!page1|page2).*'] = "user/profile";

Changing the name of a domain internally

I have given my client a domain like www.xyz.com/test.
Now for some reason I want to change it to www.xyz.com/testing but I want that client will continue to type www.xyz.com/test.
How can I do it?
You can setup a HTTP 301/302 redirect from /test to /testing.
Well, if you're on an Apache server you should be able to use an htaccess file to route the URL to the actual location on your server. There's a couple of ways of creating 301/302 redirects, such as a plain RewriteRule that routes all calls to "xyz.com/testing/..." to the actual location on the server, "xyz.com/test/...".
Good luck! =)

Resources