Invision Community 4: SEO, prepare for v5 and dormant account notifications Matt November 11, 2024Nov 11
Posted April 14, 20177 yr I want to give my members who contribute to downloads an easy URL to distribute. I am thinking it can be done with rewrites in the niginx config file but not sure how to make it work. For example how can I make https://invisionpower.com/adriano-faria/ lead to https://invisionpower.com/profile/114025-adriano-faria/content/?type=downloads_file help appreciated. Thank you
April 14, 20177 yr Author I tried this location = /adriano-faria { return 301 https://invisionpower.com/profile/114025-adriano-faria/content/?type=downloads_file/ } it fails. Nginx won't boot until I remove this location block from the config file. ugh.. I can't get my finger on this.
April 18, 20177 yr You simply forgot the semicolon on the second line location = /adriano-faria { return 301 https://invisionpower.com/profile/114025-adriano-faria/content/?type=downloads_file/; } In the future, you should test your nginx configuration before reloading or restarting nginx. I believe the test flag is -t: $ nginx -t
April 23, 20177 yr Author HI However, I still can't make it work for the life of me Now my Nginx isn't crashing and -t passes but it doesn't work!!! Here is my whole nested set of blocks http { server { listen 80 default_server; server_name mysite.org www.mysite.org; location = /kyrakane { return 301 https://www.mystie.org/forum/index.php?/profile/49911-kyrakane/&tab=node_downloads_Files/; } } #more code for http block here omitted for this post } Shouldn't I be able to type www.mysite.org/kyrakane and get the link listed above? Thank you
April 23, 20177 yr Do you want it to keep that path or just redirect? If its just redirect cant you use: rewrite ^/kyrakane/(.*) /forum/index.php?/profile/49911-kyrakane/&tab=node_downloads_Files/$1 permanent; rewrite ^/kyrakane /forum/index.php?/profile/49911-kyrakane/&tab=node_downloads_Files/ permanent; Use 1 of those, the first line is just to show how you can pass a path as a variable but I think the second is what you want. Just use that in your block at the top-ish area. No location needed.
April 24, 20177 yr Author 4 hours ago, ZeroHour said: Do you want it to keep that path or just redirect? If its just redirect cant you use: rewrite ^/kyrakane/(.*) /forum/index.php?/profile/49911-kyrakane/&tab=node_downloads_Files/$1 permanent; rewrite ^/kyrakane /forum/index.php?/profile/49911-kyrakane/&tab=node_downloads_Files/ permanent; Use 1 of those, the first line is just to show how you can pass a path as a variable but I think the second is what you want. Just use that in your block at the top-ish area. No location needed. I removed location to the above server block and added the second line in your example www.mysite.com/kyrakane leads to 404 error page. Still not working I fear
April 24, 20177 yr Not sure why, I use those redirects in the server block under the first few lines of the server block code but before any location blocks in there.
April 25, 20177 yr Author 4 hours ago, Steph40 said: I use this myself: I like this app, it's clean and well done. As far as I can tell though, it only gets me here https://www.mysite.com/forum/index.php?/kyrakane which is a start but I really want www.mysite.com/kyrakane might not be able to get there.
April 25, 20177 yr 16 minutes ago, superj707 said: like this app, it's clean and well done. As far as I can tell though, it only gets me here https://www.mysite.com/forum/index.php?/kyrakane which is a start but I really want www.mysite.com/kyrakane might not be able to get there. Do you have: location / { try_files $uri $uri/ /index.php?$args; } inside your server block?
April 25, 20177 yr Author Just now, Steph40 said: Do you have: location / { try_files $uri $uri/ /index.php?$args; } inside your server block? I don't have it anywhere.
April 25, 20177 yr 11 hours ago, superj707 said: I don't have it anywhere. Then you need it in your nginx server block for you website or in the default server block. It is that line that makes the rewrite possible on nginx. the default.conf server block should look like this: server { root /usr/share/nginx/www; index index.php index.html index.htm; server_name localhost; location / { try_files $uri $uri/ /index.php?$args; } location /doc/ { alias /usr/share/doc/; autoindex on; allow 127.0.0.1; deny all; } } @superj707 If you had this line before: location / { try_files $uri $uri/ /index.html; } Replace it with: location / { try_files $uri $uri/ /index.html; }
Archived
This topic is now archived and is closed to further replies.