How can I hide the requests parameters in the URL string? - codeigniter

I'm using the Facebook php sdk to authenticate users from my website. However after successful authentication, the URL goes to:
http://URL/?state={STATE}&code={CODE}
How can I remove the state and the code from showing up?
I'm using Codeigniter and Nginx so .htaccess is not working..
Thank you

rewrite ^(.+)?state=(.+)&code=(.+) www.yoursite.com$1 permanent;

Related

How do I set a redirect for my root index.html in jekyll?

I have jekyll-redirect-from plugin, but it only really works for pages that aren't my root homepage.
For example, if a user types in www.mywebsite.com/index.html I want it to redirect and display the URL as www.mywebsite.com
Everything I can find about this is focused on blog posts and other pages than the index. Has anyone had this issue?
You don't need a redirect, because www.mywebsite.com/index.html and www.mywebsite.com are the same page. (The browser just shows the index file by default if you go to www.mywebsite.com.)
You need the browser to rewrite the URL, while remaining on the same page. You need to do this on the webserver.
.htaccess
If your site is on an Apache server and you have access to the server, you can use an .htaccess file to rewrite the URL from www.mywebsite.com/index.html to www.mywebsite.com.
There are online .htaccess generators like this one that help get the syntax right.
There are similar methods for rewriting URLs on nginx webservers.
GitHub Pages
If you're on a service like GitHub Pages, you can't use .htaccess. A free workaround is to use Netlify to deploy your site, because you can set up redirects on Netlify. Create a free account on Netlify and add a new site from GitHub there.
In the root of your repo, create a netlify.toml file containing this:
# Redirect /index.html to /
[[redirects]]
from = "/index.html"
to = "/"
Netlify will now handle that redirect.

Not able to access api URL in Prestashop - 404 error

I am very disappointed as I am not able to access my Webservice in my site that is running with Prestashop 1.6 version. Due to this I am not able to connect with one of the major Prestashop ship module.
In short when I access https://example.com/api it is redirecting to 404 page.
Can anyone help me to sort out this issue?
I spend 2 hours on this problem and I solved it by htaccess on the root directory.
I saw that line alone :
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
I just add this before :
RewriteCond %{HTTP_HOST} ^yoururl.com$
Now it works
Interesting... The answer could be in your HTTP server's configuration...
By the way:
does your .htaccess file which is generated by PrestaShop and is located in your PrestaShop root folder have these lines:
RewriteRule . - [E=REWRITEBASE:/]
RewriteRule ^api$ api/ [L]
RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
?
Check CGI Mode option in webservices configuration.
Activate DEBUG MODE in Prestashop. Some detailed errors may appear.
Good luck.
To use PrestaShop api following things should be done:
Enable PrestaShop webservice : Go to Advance Parameters > Webservice and enable PrestaShop web service.
Add a key: After enabling the webservice add a key and select the resource which you want and give the desired permission to that resource.
The endpoint to your store's webservice is located in the /api/ folder at the root of your installation of Prestashop:
If PrestaShop is installed at the root of your server, you can access
the API here: http://example.com/api/
If PrestaShop is installed in a subfolder of your server, you can
access the API here: http://example.com/prestashop/api/
To access it, you need to provide your API key when request. There is no password, providing your API key is enough – and therefore the key should be kept secret by the user!
You can either type the API endpoint address directly then enter your API key, or indicate your API key in the address. Here is an example, with "UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX" being the API key.
At the root of the server:
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX#example.com/api/
In a subfolder of the server:
http://UCCLLQ9N2ARSHWCXLT74KUKSSK34BFKX#example.com/prestasshop/api/
For more help you can view the prestashop webservice documentation.

https on TYPO3 - show via pagetree

I have a TYPO3 site now running under https. All works fine, except for clicking on Show on a page in the Page tree. I then get an invalid URL which starts like 'https://https//www.'
Steps I did:
Domain record bla.com 301 redirect to https://www.bla.com
Domain record https://www.bla.com
Force SSL backend via $GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = 2;
Should I set something else to have correct 'Show' links from the pagetree?
thanks
Do you use the backend over SSL too? Died you try to set the url schema inside each page settings from http:// to https:// to exclude this as the error?
In tsconfig TCAdefaults.pages.url_scheme = 2 needs to be added (I already had that, but thank you Paul). But a domain record was wrong; the 2nd one needed to be entered without https://

MVC Routing / HostHeader does not work when I use RequireHttps

I'm currently experiencing an issue whereby my MVC site is not responding correctly using IIS 6.
I've setup a url as http://mysite.co.uk which automatically redirects to the correct MVC home page. As the site contains sensitive information I have added the [RequireHttps] attribute to each controller class to automatically redirect the browser to an https url of https://mysite.co.uk which works correctly.
When I access the site as http://www.mysite.co.uk the site correctly redirects to https://www.mysite.co.uk/Default.aspx but it then responds with
Bad Request (Invalid Hostname)
It looks like any time I use www. as part of the url it fails to respond but I have a hostheader setup as www.mysite.co.uk under the IIS website. Is there anything in particular I need to do to make MVC understand the www. part of the url in terms of routing?
Thanks,
Brian.
IIS 6 doesn't add ssl host headers as you think it would. see my article at:
http://completedevelopment.blogspot.com/2009/06/multiple-host-headers-ssl-and-wcf.html

MOD Rewrite Mask for Image URL

Okay so I am launching a cloned e-commerce site. I want to create a rewrite rule for the image folder for the second site to fetch images from the first site.
RewriteRule ^alice.gif$ www.rhinomart.com/images/h_home.gif
When I go to alice.gif directly through the browser it simply redirects me to the rhinomart.com URL and image. How do I prevent the redirect from occurring? When I go to http://www.acnbiz.net/alice.gif it should fetch alice.gif directly from Rhinomart.com/images and not redirect. is it possible???
If you want to rewrite to an external site but not redirect the browser then you will need to proxy the request by enabling mod_proxy and using the [P] flag.

Resources