how do i redirect a specific path to another path in nginx? - redirect

I need to redirect a specific path:
mydomain.com/old-path/
to a new path, permanently:
mydomain.com/new-path/
i am using elgg software (elgg.org) and presently when someone navigates to the /old-path/ folder they view a page (rather than a folder listing) - thus no specific page name is used.
i tried the various methods of redirecting that can be found via google for nginx and so far none have had any effect. they mostly are either for a specific page or a directory, yet what i am doing, is, i suppose, technically neither a specific page or a directory..
anyone know how to achieve this?
thanks

You can use nginx HttpRewriteModule to do this.
rewrite ^/old-directory/(.*)$ /new-directory/$1 last;

Related

Github not detecting an inner index.html

I'm publishing my own profile site on github on https://yilmazhasan.github.io/pwp
It was working before some changes, now it gives 404 for https://yilmazhasan.github.io/pwp/src/index.html although there is an index.html file.
I'm redirecting pwp/index.html to pwp/src/index.html, it sees first one but not second one.
Since it is public, they can be seen on https://github.com/yilmazhasan/pwp
What can be caused to this?
(Note: It works on localhost)
Even without redirecting pwp/index.html to pwp/src/index.html, you could simply change your publication folder to src, as seen here (for the docs folder, but the same idea applies)

Joomla! Too Many Redirects

I'm trying to build a website (it's not my first time), using latest version of Joomla! (3.8.10), but I have a problem - tabs in the main menu don't work. When I try to go to other page, I have an error:
ERR_TOO_MANY_REDIRECTS
I almost solved this problem by changing:
$sef="1"
to
$sef="0"
in configuration.php, but it caused strangely long addresses.
Ok, I found the solution. Need to add:
$_SERVER['HTTPS']='on';
in index.phpfile, behind the <?php
Maybe someone will use it.
This is most likely a problem with your .htaccess file. When you change $sef=0, you are basically telling the system to not use your .htaccess file. I suggest backing up your current one and replacing with the default Joomla one. It is the one that comes in the download package and is named htaccess.txt. Upload and rename to .htaccess to overwrite existing.

Privoxy whitelist faulty on redirect

My problem, in a nutshell, is the following:
I use Privoxy to set up a whitelist of sites in Raspbian Jessie on Chromium. I have Chromium start on boot with the following snippet in lxsession/LXDE-pi/autostart:
#privoxy
#chromium --incognito --kiosk --proxy-server=127.0.0.1:8118
This does work as intended, with every site except the ones I specify blacklisted.
Now I edited /privoxy/templates/blocked so that instead of the usual site it will give me a redirect to a certain site should a link be opened that is not on the whitelist:
<!DOCTYPE html>
(Stuff happens)
Please go back to this site.
example.com being one of the sites I whitelisted. The problem is, it simply redirects me to the "blocked" page again, making me stuck in a loop. Does anyone have a clue why this would be and how I could work around it? I tried using
window.history.back()
however it doesn't seem to work either.
I use Kiosk mode because I want to use this in a context where entereing URL-adresses is not desired, just to clarify my Chromium-call.
Well, I solved it, at least partially. Turns out that I need to add http:// in front of the URL, since it gets added to the already existing URL otherwise. Which is fair, but a bit awkward for me to admit. HTML isn't exactly my forté. Marking it as solved and keeping it, just in case somebody stumbles upon a similar problem.

How do relative URLs work in Sinatra?

I am hosting my Sinatra application using Apache with Passenger. It's hosted within a subfolder -- meaning, my main site is example.com, my application is at example.com/popcorn.
So I have a get '/' route, and that works fine. The problem is that my view includes a HTML form that makes a post request to upload, and the post '/upload' route isn't handling it. Instead of example.com/popcorn/upload, it's trying to get example.com/upload.
So I figure okay, not the ideal solution, but for now I'll hardcode the form action URL. But that doesn't work either -- making the action popcorn/upload fails too. This is where I get a little baffled, and my Google-fu was weak, I couldn't find help there.
Maybe I could have some kind of Apache rewrite rule, but is that the correct solution? Am I missing something? I would really appreciate a tip here because it feels like I've messed up something very simple and it's really bugging me.
You probably want the url helper method. That takes into account where the app is mounted on the server:
url('/upload')
The above code will evaluate to something like this:
http://example.com/popcord/upload
Inside your app you shouldn’t need to change anything, this will be routed to the existing post '/upload' handler.

Working with Facebook Connect

I have two files with identical code (it is the code they mention here: http://developers.facebook.com/blog/post/198). I have one of these files here: http://gnucom.cc/test.html and another one of these files here: http://blog.gnucom.cc/test.html. I have the main URL set to gnucom.cc and the Connect URL set to http://blog.gnucom.cc.
For the life of me, I cannot figure out why the version accessed from the subdomain doesn't work. I receive a loading icon and that is it - afterwards it disappears.
Can anyone suggest what I may be doing wrong?
http://wiki.developers.facebook.com/index.php/Supporting_Subdomains_In_Facebook_Connect
You should type in http://gnucom.cc instead of http://www.gnucom.cc (if it's not already this way)