Welcome! Log In Create A New Profile

Advanced

Problem in change URL and remove a phrase

Posted by ariya 
Problem in change URL and remove a phrase
May 08, 2021 04:41AM
Hello. Previously my site URL was as follows and there was an extra "forum" word at the end of the URL:

https://mysite.com/forums/forum



I managed to remove the word "forum" from the end of the URL using the following rewrite, and my URL became https://mysite.com/forums.

rewrite ^ / forums / forum $ https://mysite.com/forums permanent;



There are now a number of other old URLs that do not work with rewrite above. For example, the following address:

https://mysite.com/forums/forum/%D8%A8%D8%AE%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%B4-2210



The "forum" phrase in the middle of the url should be removed and then converted to the following address:

https://mysite.com/forums/%D8%A8%D8%AE%D8%B4-%D8%A2%D9%85%D9%88%D8%B2%D8%B4-2210




But this does not happen. I also put the following rewrites in the Nginx configuration file but the "forum" phrase is still in the middle of my urls.

rewrite ^ / forums / forum $ https://mysite.com/forums(.*)$1 last;
rewrite ^ / forums / forum $ https://mysite.com/forums$1 last;
rewrite ^ / forums / forum (. *) \. html $ /forums(.*)$1 last;
rewrite ^ / forums / forum (. *) $ /forums(.*)$1 last;



Where is the problem and how can I remove this word "forum" from the middle of my URLs?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready