Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have an application built with CodeIgniter that a 3rd party service (an email service provider) is making http requests containing POST data to when certain events occur. The problem is, the url that this 3rd party service is making the requests to is not fully modifiable by me, specifically, it make its requests to a file named w_4.php at the domain and directory that I specify.
Instead of having this separate file outside of the CodeIgnitier stack, I would like to, using .htaccess, rewrite all the requests made for this file to a controller within my codeigniter application, i.e. api/my_controller/my_method. But I need the POST data in the request intact, so I would think a redirect could not be used.
I tried something like this in my .htaccess:
RewriteCond $1 (w_4\.php)
RewriteRule ^(.*)$ index.php/api/my_controller/my_method
While the request does get routed to codeigniter, I just get a 404 even though that controller/route does exist.
The answer is to use the P proxy flag in the RewriteRule. As detailed here https://stackoverflow.com/a/359224/192694, the flag indicates that the request should be passed off to the proxy module intact, including its POST data.
For more info: http://httpd.apache.org/docs/2.2/rewrite/flags.html#flag_p
Related
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 9 years ago.
Improve this question
I have a link structure that is managed by an apache server. Some pages can be called with different url but with a php redirect the user will see just the canonical url for the page.
canonical url: www.example.it/490/persons/jan-antone-vian
generic url that call the same page: www.example.it/490/
My question is if it is correct to insert the url with just the id (www.example.it/490/) in some links (is much easier to manage the links) for SEO?
first of all, it's sure that a well constructed URL is better for SEO (url with keywords)
What you can do, and what you seems to have done :
keep the www.example.it/490/ URL for sharing,
add a 301 redirection to your
www.example.it/490/persons/jan-antone-vian when arriving in the first
url (www.example.it/490/). The SEO juice should be transfered to the
full url constructed.
Google says that ONE (and only one) URL has to be related to ONE (and only one) content, so you cannot let the both url displaying the same content. (you could be penalised for duplicate content...)
Note that a 301 is announced that it transfers the FULL SEO JUICE, but it's common to not do many 301 redirections in cascade.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I have a server and every page has a redirect to use the SSL (https) using htacess. My question is what if someone types in the url http://www.domain.com/ and it redirects to https://www.domain.com was the information sent in the original request un-encrypted?
was the information sent in the original request un-encrypted?
Yes, the http://domain.com/ request is unencrypted, as is the response that contains the redirect. The SSL handshake happens before any data is sent, and until the browser knows to initiate an SSL handshake on the SSL port, everything is unencrypted.
Jon Lin's answer is correct. If this is a security concern, then it's best to ensure that the user only connects to your site by way of https, or redirecting from their first connection, before any sensitive information is sent. This can be done using the .htaccess file.
Yes the information passed via http protocol remains unencrypted. All the communication via http will be then unencrypted. Redirection occours after transmission of packet to the redirecting server so this communication can not be encrypted just by redirecting to https site.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a link on a page, for example http://123.456.789/~preview/websites.com and I need this to actually display and redirect to a new address, for example website.com
Can this be done using htaccess?
Yes.
I'm not sure what is the page and what is the link in your question, you're not being very clear. However, take this example:
I have a page /websites.html and on it I link to /websites/example.com which should be redirected to example.com:
RewriteRule ^websites/example.com http://example.com/ [R,L]
If you would want to redirect all urls in your /websites/ folder to their respective website:
RewriteRule ^websites/(.+)\.(.+)$ http://$1.$2/ [R,L]
(this would redirect /websites/test.com to http://test.com, /websites/www.del.icio.us to http://www.del.icio.us, etc)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I own 2 domain names "domain1.com" and "domain2.com", I want to redirect subdomain.domain1.com to domain2.com/directory using DNS (preferably). Can anyone assist (I am an amateur at domain management)?
To my knowledge the is not possible with pure DNS.
DNS is only there (in case of A/AAAA/CNAME records) to take a domain name (a.b.c.domain.com) and return you the ip address (111.222.111.222).
Some DNS providers offer "redirect" but the most reliable way is if you configure "a.b.domain.com" on your server and sind a redirect request to the client.
One way is to do it with .htaccess like:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^subdomain\.domain1\.com$
RewriteRule ^/?$ "http\:\/\/domain2\.com\/directory" [R=301,L]
(Note, the .htaccess sample is not tested, watch out for regex typos)
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
In IIS7.5, I have a URL Rewrite rule that redirects http requests to https. If I check "Require SSL", I get a 403 Unauthorized instead of a redirect, which makes sense.
Is there a way to use them together? Would there even be a benefit? I'm assuming no since every http request would be redirected, but I'm checking here in case I'm wrong.
Is this secure?
The 2 options work a very different way.
If you use the Require SSL option, every single page of your website has to be accessed by HTTPS and it means that (as you have seen it), if you forget the HTTPS and try to access with HTTP, you will have a 403 Unauthorized.
If you use the URL Rewrite Module, you can setup some pages or your whole website to be redirected to HTTPS (and some part back to HTTP if needed), and if a user forgets the HTTPS and hits the HTTP, he/she will be redirected to the HTTPS url.
As of having them to work together, there is a solution, but I don't really see the point:
[...] you will need to disable “Require SSL” checkbox for the web
site. If you do not want to do that, then you can create two web sites
in IIS – one with http binding and another with https binding – and
then add this rule to the web.config file of the site with http
binding.
http://blogs.iis.net/ruslany/archive/2009/04/08/10-url-rewriting-tips-and-tricks.aspx
(Section 4. Redirect to HTTPS)