0

I am using nginx as reverse proxy with apache for my website. I have pretty url's enabled for SEO purpose, with NGINX rewrite URL's.

for example the pretty url :

mysite.com/song/I-love-music

works for this ugly url :

mysite.com/song.php?url=I-love-music

And it works perfectly.

But I have an issue now, if someone visits this type of urls directly

mysite.com/song.php?url=I-love-music

Then this url is loading properly , same as

mysite.com/song.php?url=I-love-music

It is a big problem for SEO purpose, I need this ugly url to permanently redirected to this pretty url :

mysite.com/song/I-love-music

Please help me how do I rewrite urls in NGINX for this. I tried with apache rewrite rules in htaccess but that gives me server error..

La Reyna
  • 128
  • 2
  • 12
  • any suggestions, anyone? – La Reyna Nov 25 '18 at 19:09
  • This is not a duplicate question, Please help me. I have tried all the other solutions. – La Reyna Nov 25 '18 at 19:25
  • Not a fix, but I suggest you look at a front controller, especially with Nginx. You send everything that’s not a file or directory to your /index.php file, and use this file to handle all of your url routing. Look at php’s $_SERVER[‘REQUEST_URI’] variable, and handle the logic using this variable. – user9189147 Nov 25 '18 at 19:52

0 Answers0