By dasa gaja
Need to configure below rewrite rule in Sub-directory in nginx configuration. subfolder name is example.com/interview/
location / {
rewrite ^/([^/]+)/$ /interview-category.php?hri_id=$1;
}
location /questions {
rewrite ^/questions/([^/]+)$ /hrinterview-forum.php?topic=$1;
}
any help thanks
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @dasa,
I’m not sure I quite understand the question, can you be a little more specific, do you wish to make a rewrite rule everytime example.com/interview/ is visited to somewhere else or the other way around?
Anyway, here are some suggestions.
location = / {
rewrite ^ http://example.com/interview/ redirect;
}
This’ll just do requests specifically for the root. If you need to catch everything (redirect http://example.com/somearticle/something.html to http://example.com/interview/somearticle/something.html), then you’ll need something more involved:
location /interview/ {
# Empty; this is just here to avoid redirecting for this location,
# though you might already have some config in a block like this.
}
location / {
rewrite ^/(.*)$ http://site.com/interview/$1 redirect;
}
Regards, KDSys
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.