w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
redirecting pages does not redirect when on mobile
Sometimes header doesn't work very well with sessions so i would recomend you try: $redirect_url = urlencode("http://" . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'] ); echo "<meta http-equiv=refresh content='0; url=http://maconbeercompany.com/age-verification.php?redirect=". $redirect_url."'>";

Categories : PHP

Redirecting folder from one domain to another using .htaccess 301 redirect
Replace your code with this: Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www.)?olddomain.com$ [NC] RewriteRule ^oldfolder/(.*)$ http://newdomain.com/newfolder/$1 [L,R=301,NC]

Categories : Regex

Redirect using .htaccess to redirect multiple old pages and non-www to www
You must take several steps: Edit the home_url and site_url options for the main sites (in wp_options if your table_prefix is "wp_", as you want to change the urls of your main site). Edit the domain of your main blog in wp_blogs to www.your-domain version Edit wp-config DOMAIN CURRENT SITE like this: define('DOMAIN_CURRENT_SITE', 'www.example.com'); //your new www one! Go to wp-admin of your blog and reset permalinks Your RewriteRule is fine, but you can make it more dynamic to use in other sites like this: RewriteCond %{HTTP_HOST} ^example.com RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] Or, if your host multi-domains into the same network, like this: RewriteCond %{HTTP_HOST} ^(example1|example2|exampleN).com RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=30

Categories : Misc

Redirect Loop while redirecting all http requests to https using .htaccess
Just in case somebody have redirect loop when using Apache http->https rewrite behind load balancer, here's solution that worked for me. I had the same problem when used RewriteCond %{HTTPS} off for Apache behind load balancer, when load balancer does SSL stuff. If https version of the site is not configured via Apache ModSSL it doesn't set %{HTTPS} variable to "on" and keeps redirecting infinitely. The simplest solution to fix it is to target all https traffic to another Apache VirtualHost (when SSL is handled by load balancer) that is the copy of main one, but has different port (lets say 81). And in .htaccess do mod_rewrite for everything that is not on port 81: ReWriteCond %{SERVER_PORT} !^81$ RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L] The second way to do this is to se

Categories : Apache

Redirect only sub pages using htaccess
I think what you are searching for is a condition that checks if the file that is requested is not a filename. That's what RewriteCond %{REQUEST_FILENAME} !-f. It is true if %{REQUEST_FILENAME} (I believe an absolute path to a file on the server, based on the request), is not a file. (Please note: I haven't tested this code as I don't have access to a server at this location, but I think it should work.) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} ^domain.com [NC] RewriteRule ^(.*)$ http://sub.domain.com/$1 [L,R=301] An other solution would be to only rewrite the url if the requested url contains a slash. It would redirect domain.com/folder/index.php, but not domain.com/index.php. RewriteCond %{REQUEST_URI} ^/([^/]+)/(.+)$ RewriteCond %{HTTP_HOST} ^domain.com [NC] Rewr

Categories : Htaccess

Redirect Desktop Internal Pages to Correct Mobile Internal Pages with Htaccess
At the end, you have two RewriteRule lines which I believe should be changed to: RewriteRule ^/?$ http://m.domain.com [R=302] RewriteRule ^/?(.*)/?$ http://m.domain.com/$1.html [R=302,L] The ^/?(.*)/?$ means give me a string that starts at the beginning (^) and gives me all characters ((.*)) until the end ($) without the trailing/beginning (/) if there is one (?). The http://m.domain.com/$1.html means that if the address is http://www.domain.com/internal-page/ then it becomes http://m.domain.com/internal-page.html. The [R=302,L] should mean a 302 redirect (R=302) and the last rewrite (L), so no other rewrites can occur on our URL. EDIT: I believe that in the case of your RewriteRules the first one was redirecting to http://m.domain.com in the event that the URL was just the domain,

Categories : Htaccess

Redirect all https to http, except 3 pages [htaccess / php]
Give this plugin a go: http://wordpress.org/plugins/wordpress-https I personally use it all of the time. You can make every page https or can go into individual pages/posts and just make those individually secure. EDIT RewriteEngine on RewriteCond %{SERVER_PORT} =80 RewriteRule ^bookingstep1/?$ https://URL HERE/bookingstep1[R=301,QSA,L,NE] RewriteRule ^bookingstep2/?$ https://URL HERE/bookingstep2[R=301,QSA,L,NE] RewriteRule ^bookingstep3/?$ https://URL HERE/bookingstep3[R=301,QSA,L,NE]

Categories : Wordpress

.htaccess redirect/rewrite from one url to another, and subpages to other pages
Here's a solution: .htaccess for old domain Options +FollowSymLinks RewriteEngine on RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L] In the above, you could place redirect rules to catch certain pages and forward them to their new location, like this: Redirect 301 /2012/05/old-post http://www.newdomain.com/old-post Be sure to place the redirect directives above the rewrite rule that catches everything else. .htaccess for new domain Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} !^www.[a-z-]+.[a-z]{2,6} [NC] RewriteCond %{HTTP_HOST} ([a-z-]+.[a-z]{2,6})$ [NC] RewriteRule ^/(.*)$ http://%1/$1 [R=301,L] Found this solution on: https://forums.digitalpoint.com/threads/htaccess-redirect-all-traffic-to-another-site.867280/ I've done similar

Categories : Htaccess

Apache redirect all sub pages to home page except specific pages
In the VirtualHost section of www.domain.co.uk insert this code just below RewriteEngine On line: RewriteCond %{REQUEST_URI} !^/(terms|request-information)(/.*|)$ [NC] RewriteRule ^ / [L,R=301] EDIT: Multiple rewrite rules seem to cause a redirection error, only use one.

Categories : Apache

.htaccess not redirecting from old url to new url
You need to have your redirecting happen before you route URIs to /index.php. Also, since Redirect is part of mod_alias and your other redirect/routing rule is mod_rewrite, the URI is being processed twice when it's not supposed to. You should just use mod_rewrite and add the rules to the beginning: RewriteEngine On # Redirect non-www urls to www RewriteCond %{HTTP_HOST} ^mysite.com [NC] RewriteRule (.*) http://www.mysite.com/$1 [R=301,L] RewriteRule ^payments/charity_and_donations/paid http://www.mysite.com/charity [R=301,L] RewriteRule ^outwards/office_furniture/damaged http://www.mysite.com/office_assets [R=301,L] RewriteRule ^funding/business_and_person/inward http://www.mysite.com/funds [R=301,L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule

Categories : Htaccess

.htaccess why is it not redirecting?
Why not just turn it around to keep it more simple? RewriteEngine On RewriteCond %{REQUEST_FILENAME} -s [OR] RewriteCond %{REQUEST_FILENAME} -l RewriteRule ^.*$ index.php [NC,L] This should rewrite all files (With content) and symlinks to index.php and do nothing with anything else. Less lines, less confusion..

Categories : Htaccess

htaccess not redirecting url
You don't need the RewriteCond as the rule will be doing the match anyhow, you just need RewriteRule ^contrib/api/ /content/apis/apis.php [L] This will rewrite any url starting with contrib/api to the file /content/apis/apis.php

Categories : Htaccess

301 Redirect all pages to root, not index.html, and also redirect all non-www to www
You have most likely something like this in your httpd.conf: <IfModule dir_module> DirectoryIndex index.php index.php3 index.html index.htm </IfModule> If you request a folder (and http://example.com/ is a request to a folder), it will try index.php first, then index.php3, etc, etc, and the first one that exists it will shown. You'll have to delete that from your httpd.conf if you want every request to end up as http://example.com. It'll show a directory view of your www-root folder unless that has been disabled.

Categories : Htaccess

Redirecting all .HTML to .PHP pages but not from one directory?
Add this to your .htaccess in your web root / directory. Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^shop.domain.com$ [NC] RewriteCond %{REQUEST_URI} !^/shop/? [NC] RewriteRule ^([^/]+).html?$ $1.php [R=301,NC,L] This won't redirect any sub-directory including shop. In case you want to allow that (except shop) use RewriteRule ^(.+).html?$ $1.php [R=301,NC,L]

Categories : Htaccess

Login Button and redirecting asp.net pages
Here is what I revised to: `Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Login1.Click Dim mySqlConnection As Data.SqlClient.SqlConnection Dim mySqlCommand As Data.SqlClient.SqlCommand mySqlConnection = New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("ConnectionString1").ToString()) Dim sql As String = "SELECT UserPass FROM MyUsers WHERE loginId = '" & Me.loginuser.Text & "'" mySqlCommand = New Data.SqlClient.SqlCommand(sql, mySqlConnection) Dim redirectPage As String = Request.QueryString("returnUrl") If Membership.ValidateUser(loginuser.Text, loginpass.Text) Then FormsAuthentication.SetAuthCookie("username", True) If (Roles.IsUserInRole

Categories : Asp Net

Redirecting on exception from included jsp pages
Add following code to main.jsp <%@page errorPage="Error.jsp" %> Add Error.jsp in web-app Error.jsp <%@page isErrorPage="true" %> <!-- print some message --> <%= exception.toString() %> No need to specify the <%@page errorPage="Error.jsp" %> line in header and footer file just add it in main.jsp..

Categories : Jsp

.htaccess with codeigniter redirecting
For test.html you can do it like this you .htaccess RewriteEngine On RewriteBase / RewriteRule ^test.html$ index.php/test/test [L] OR in routes.php you can also define a route $route['test.html'] = 'index.php/test/test';

Categories : PHP

Why is my .htaccess file not redirecting?
If you get internal server error it can be mod_alias disabled. Check your httpd.conf file for line similar to that LoadModule alias_module modules/mod_alias.so. If it does not exist then try adding it.

Categories : Htaccess

Page is not redirecting by htaccess
You need to test for certain conditions - or a way for Apache to detect you want rule 2 vs rule 1. Perhaps some prefixed keyword? RewriteCond %{REQUEST_URI} !(.png|.jpg|.gif|.jpeg|.bmp)$ RewriteRule ^flights-([a-zA-Z0-9_-+ ]+)$ flight.php?flights=$1&slug=$1 RewriteRule ^manual-([a-zA-Z0-9_-+ ]+)$ manual-page.php?url=$1&slug=$1

Categories : PHP

redirecting url through htaccess by masking it
You can try this htaccess redirect, it should generate this code for you for a 302 redirect. #302 Redirect Entire Old directories RedirectMatch 302 domainb(.*) http://www.domainA.com/domainb$1 since you want to keep the old domain on the address bar, the 302 redirect code will do the trick

Categories : PHP

Jquery Mobile when redirecting or changing url, pages does not have any css
I think this can solve your problem: $(document).bind('pagechange', function() { $('.ui-page-active .ui-listview').listview('refresh'); $('.ui-page-active :jqmData(role=content)').trigger('create'); });

Categories : HTML

.htaccess not redirecting to error page
it doesn't redirect because you redirect all traffic to index.php so http://reddyclasses.com/err does exist. You need to trigger 404 error from PHP itself in this case..

Categories : PHP

.htaccess not redirecting successfully for pretty url's
Change: RewriteRule ^(.*)$ ./backend-scripts/url_parser.php to RewriteRule ^(.*)$ ./backend-scripts/url_parser.php?url=$1 Then change $requestURI = $_SERVER['REQUEST_URI']; to: $requestURI = (!empty($_GET['url'])) ? $_GET['url'] : ''; // no url supplied WARNING: Do not pass user supplied values to include(). Make sure the paths are checked against a proper whitelist, otherwise a malicious user can hijack your server.

Categories : PHP

.htaccess modrewrite not redirecting my links
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^(.+?.html)$ /news-details.php?id=$1 [L,QSA,NC]

Categories : PHP

ajax and javascipt for redirecting between two pages with an intermediate page. also using C#
You can put your intermediate features inside a div, which is set to "display: none;" so as to hide it until you are ready for it. Rather than linking to the page 3.aspx when clicking on the words "go to final page..", you can use javascript to display and position the div (there are also some 3rd party products that make doing this easier) where the user can fill in their checkboxes, which are now being displayed on the screen. Inside the div will be a button which actually does a postback, saves whatever it needs to into session, and then does a "Response.Redirect("3.aspx");", where you final page can be displayed.

Categories : Javascript

.htaccess - redirect all to index.php, but redirect particular link to another
You have two problems here. First, the more specific rewrite rule has to come before the general one. Second, your specific rewrite rule is backwards. RewriteEngine processes rules from top to bottom, much like a programming if/else if/else. This means that you want to put your catch-all case (aka the ^(.*)$) at the bottom of the list. All rules before this need the [L] attribute to stop further processing after they are matched. For the second part, you want to make the browser link http://www.domain.com/link point to the actual file http://www.domain.com/some_real_page.php. In your sample code, you are doing the opposite. The end result should look like this: RewriteEngine on RewriteCond %{REQUEST_URI} ^/link$ RewriteRule ^(.*)$ some_real_page.php [R=302,L] RewriteCond %{REQ

Categories : Htaccess

Redirecting using .htaccess and Zend Error Controller?
If there are a smallish number of 'known' URLs you want to redirect, you can do this with htaccess alone, which will be much faster than doing it with PHP. Add this line to the top of your .htaccess file (above the Rewrite stuff): Redirect 301 /about/about.html http://www.example.co.za/about/about/ and then repeat that for each URL you want redirected.

Categories : Apache

Htaccess issues - Redirecting from pretty url to php version
Try this one, you have not added flags to end the line in HTACCESS. Options All -Indexes ReWriteEngine On RewriteRule ^page/([a-zA-Z0-9_-]+)$ page.php?pageurl=$1 [L] RewriteRule ^([a-zA-Z0-9_-]+)$ category.php?categoryurl=$1 [L] RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)-([a-zA-Z0-9_-]+)$ product.php?category=$1&subcategory=$2&productid=$3&producturl=$4 [L] RewriteCond %{HTTP_HOST} www.website.com$ [NC] RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]

Categories : PHP

.htaccess Redirecting All Errors to a PHP file with GET variable
You can use apache error document config. Here is the more info http://httpd.apache.org/docs/2.2/custom-error.html

Categories : PHP

htaccess redirecting url where query string is urlencoded
Your file names should only include lower-case letters, numbers, hyphens, and underscores for reasons like this. If for whatever reason, you're unable to rename your files, you can do some PHP trickery: .htaccess ErrorDocument 404 404.php 404.php <?php switch($_SERVER['REQUEST_URI']){ case "/category/Science.html": header('HTTP/1.1 301 Moved Permanently'); header("Location: /category/".urlencode("Science, Engineering & Technology").".html"); exit(); break; ... } // Custom 404 page stuff I'd recommend against this because it's sloppy, hard to manage, and not expected behaviour, but if you're unable to rename the files, go for it.

Categories : PHP

.htaccess - Masking and redirecting to a subdirectory on a different server
if a user goes to mydomain.com/ they will be shown the content from myserver.com/forum/ while still being shown mydomain.com/ in the address bar. First thing you need to understand that this is ONLY possible if mod_proxy is enabled on the Apache server of mydomain.com. Once you've enabled mod_proxy, mod_rewrite and .htaccess through httpd.conf on mydomain.com, put this code in its .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteRule ^(.*)$ http://myserver.com/$1 [L,P] I will have to think little more about your 404 requirement, but if you get this working I am sure we can find a workaround for that as well.

Categories : Htaccess

.htaccess - pretty url lost after redirecting non-www to www urls
I believe problem is missing L flag in your first rule. Try this code: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / Rewritecond %{HTTP_HOST} ^site.com$ [NC] Rewriterule ^(.*)$ http://www.site.com/$1 [R=301,NC,L] RewriteRule ^([^/]+)/([^.]+.html)$ /process/?category=$1&link=$2 [QSA,L,NC]

Categories : Htaccess

How can I use .htaccess to load index.html for any URL without redirecting?
As per the Apache documentation, you only need to add a DirectoryIndex directive to your .htaccess file. This directive points to one or more files, which allows you to have redundancy in your index files. Here is an example: DirectoryIndex index.php index.html index.htm To keep it simple, though, you would need this .htaccess file in a directory called "hello-world", so that your users will type http://example.com/hello-world/ (note the trailing slash) With additional rules (using the mod_rewrite module), you may redirect URLs to add a trailing slash to those who lack one.

Categories : Htaccess

Redirecting to another website using Redirect::to()
You need to provide fully qualifying URL to Redirect::to() method, otherwise application base URL is prepended. $url = 'www.google.com'; // redirects to http://localhost:8888/www.google.com return Redirect::to($url); $url = 'http://google.com'; // redirects to http://google.com return Redirect::to($url);

Categories : Laravel

django redirect not redirecting
It seems you forgot to add a return statement before redirect(). Why is there a need for a return ? Because the redirect method is just a shortcut to a HttpResponseRedirect, so it behaves like any other action: it has to return a response. So your code should look like this: ... print 'before redirect' return redirect('customer:department-edit') print 'after redirect' ... See The Django Documentation example :)

Categories : Django

Prevent htaccess from redirecting when redirected to desired page
Check that your not already on that script, add the line below either above or below your current condition (definitely above the rewrite rule!) RewriteCond %{REQUEST_FILENAME} !old-browser.php$

Categories : Htaccess

redirect loop when redirecting to another page when logged in
I assume your ask is when you are trying to logout, the page is redirecting to default page again. Reason is you are clearing the session after it is redirected, so the Session.Abandon() doesn't get called. But I don't know if your authentication is really dependent on Session.Abandon() in which case you will again see the redirect. protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e) { Session.Abandon(); Response.Redirect("default.aspx"); } If you are using membership provider, check out the defaultUrl that can be configured to automatically redirect after the user is logged out. For manually triggering the logout, use FormsAuthentication.SignOut().

Categories : C#

Redirecting a user based on url redirect in database
After you have selected the correct URL from the database based on the user, you can user header to redirect the user. PHP header('Location: ' . $urlFromDatabase);

Categories : PHP

mod_rewrite for a 301 redirect. Not redirecting to proper location
Change your rewrite rule to RewriteRule ^news/(?!detail)([^/]+)/?$ news/detail/$1/ [L,R=301] EDIT : (How it works?) /(?!detail) is a negative lookahead but it's also non-capturing i.e. it matches / but not what comes after it; just makes sure that it isn't "detail". So, I added a capturing group ([^/]+) to capure those characters (one or more + of anything that's not a/) optionally ending with a /. Hence, the $1 now gets replaced with the matched directory name.

Categories : Htaccess

Chrome redirecting to favicon.ico with Redirect::intended()
So, you have a favicon.ico file in your document root, and it's still redirecting you? Make sure that your .htaccess is letting files slip through, and clear the Laravel session cache, by deleting the files in storage/session. Then it should work as Laravel will only handle redirects to routes it actually handles, that is, those that slip through the .htaccess rules.

Categories : Laravel



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.