How do you rewrite urls? #1173
Replies: 2 comments 4 replies
-
Please post your nginx config. This is more of an nginx question than a Winter CMS question, although you could perhaps try using the Winter.Redirect if you would like. |
Beta Was this translation helpful? Give feedback.
-
@graphixela My understanding of your question is that you want the following redirects to occur:
And that any part of the URL after
I'm not quite sure that's possible. You are using a query string for the You can most certainly do these rewrites though:
|
Beta Was this translation helpful? Give feedback.
-
I'm used to doing this with htaccess but I'm on an nginx server.
I tried multiple things and nothing worked. I'm guessing because WinterCMS has it's own rewrite logic.
I'm stumped as to what I'm supposed to do.
I have /agent?name=variable and I'm trying to get the variable to be the subdomain and stay on the same page.
So /agent?name=graphixela becomes graphixela.domain.com
The last few I had were
rewrite agent?name=$1 ^agent/([0-9]+)/?$ break;
rewrite ^/agent$ /agent/?name=$1 last;
and I know those don't do the subdomain but I was trying to get something simpler to work. I also tried with index.php before the Winter rewrite was called. I'm confused as to which URL variable is supposed to go first as I've seen both in examples that are supposed to do the same thing.
I don't know if I need to use try_files before either.
Apache was so much easier. Any help would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions