.htaccess

Unable to redirect after login in using $_SERVER['HTTP_REFERER'] in php

守給你的承諾、 提交于 2020-02-06 08:06:06
问题 I want my user to redirected to page where user clicked login so i added following code to config file so that each and ever file has access to redirect code config.php if (isset($_SERVER['HTTP_REFERER']) && basename($_SERVER['HTTP_REFERER']) != basename($_SERVER['PHP_SELF'])) { $_SESSION['redirect_url'] = $_SERVER['HTTP_REFERER']; } So that when ever i need a redirect i can simple call like bellow header('location:' . $_SESSION['redirect_url']); exit(); and when i try above code i get error

.htaccess help needed for redirects

扶醉桌前 提交于 2020-02-06 05:00:40
问题 How can I redirect both these URL's back to /blog/ and covering any variations that also include ?page_id for the first one and no_redirect for the second one. https://www.example.com/blog/page/10/?page_id=%2Ffeed%2Fatom%2F and https://www.example.com/blog/page/10/?no_redirect=true Appreciate the help! 回答1: Try : RewriteEngine on RewriteCond %{THE_REQUEST} /blog/page/10/\?page_id=%2Ffeed%2Fatom%2F [NC,OR] RewriteCond %{THE_REQUEST} /blog/page/10/\?no_redirect=true [NC] RewriteRule ^ /blog/?

WAMP Apache rewrite issue in .htaccess

落爺英雄遲暮 提交于 2020-02-06 03:36:14
问题 I am working in a WAMP environment trying to create a bare bones front controller and have started with creating an .htaccess file in my project root (i.e. www/molecule/ The .htaccess contains: Options +FollowSymLinks IndexIgnore */* # Turn on the RewriteEngine RewriteEngine On # Rules RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php Apache rewrite_module is enabled in my WAMP settings, and also uncommented in the httpd.conf, but getting an

Convert lowercase to uppercase URLs using htaccess

十年热恋 提交于 2020-02-06 03:31:14
问题 I want to convert example.com/para1/para2 to example.com/PARA1/PARA2 . I am using shared hosting so can use htaccess only for rewriting. I found below htaccess code to convert upper to lower and I tried using it by replacing all lower to upper and upper to lower but my bad luck, id did not work. RewriteEngine On RewriteBase / # If there are caps, set HASCAPS to true and skip next rule RewriteRule [A-Z] - [E=HASCAPS:TRUE,S=1] # Skip this entire section if no uppercase letters in requested URL

ErrorDocument 404 / error.php redirect but error.php page css and js not work

£可爱£侵袭症+ 提交于 2020-02-05 07:42:31
问题 I add a error.php page in my web root for all error. Error page redirect by root htaccess rule which redirect well but page css and javascript not work (not loading). But If I test as: www.myweb.com/error.php its display well format. My server Apache Version 2.2.27 and PHP Version 5.4.28 my htaccess redirect rule ErrorDocument 404 /error.php ErrorDocument 500 /error.php my full htaccess # compress text, HTML, JavaScript, CSS, and XML AddOutputFilterByType DEFLATE text/plain

Redirect in htaccess to folder and https

假装没事ソ 提交于 2020-02-05 06:03:40
问题 Using htaccess I want to force http to https and at the same time redirect to www. and to the 'public' folder where my application files are. The result should be that http://example.com should redirect to https://www.example.com/public/ To redirect to https and www I manage by using: RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301] To redirect to the 'public' folder I manage

Redirect in htaccess to folder and https

两盒软妹~` 提交于 2020-02-05 06:03:32
问题 Using htaccess I want to force http to https and at the same time redirect to www. and to the 'public' folder where my application files are. The result should be that http://example.com should redirect to https://www.example.com/public/ To redirect to https and www I manage by using: RewriteCond %{HTTPS} off RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC] RewriteRule ^ https://www.%1%{REQUEST_URI} [L,NE,R=301] To redirect to the 'public' folder I manage

Htaccess help, $1 being used before its set??? what?

送分小仙女□ 提交于 2020-02-05 05:50:32
问题 I have this snippet RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt) RewriteRule (.*) index.php?/$1 [L] It won't allow me to access a file at website.com/js/main.php but it will let me access index.php According to my webhost, $1 is being called before it is set. Any solutions? I'll accept answers when i get back tomorrow. Thank you! 回答1: I'm assuming you want the rewrite to ignore the things

How to deploy a nextjs application on cpanel?

坚强是说给别人听的谎言 提交于 2020-02-05 05:40:27
问题 I followed these steps to deploy my nextjs on cPanel. go to package.json and add this line: "homepage": "http://afsanefadaei.ir" run next build to have .next folder as my build folder go to cpanel >> file manager >> public_html folder and upload the contetn of .next folder to this directory add or edit this file: .htaccess to: but when I go to the website I face this: Do you know what is wrong with this? 回答1: Your .next doesn't have index.html file. Seems like you have server side (mostly

301 redirect with complex directory regex

泄露秘密 提交于 2020-02-05 05:14:48
问题 I am using @anubhava's solution for folder redirect which works great. 301 redirect from one directory to another I realised that I also need to have a 301 redirect for the following REDIRECT FROM 1) www.example.com/directory1/dirA/ 2) www.example.com/directory1/dirB/ REDIRECT TO 1) www.example.com/directory2/new-path-dirA/ 2) www.example.com/directory2/new-path-dirB/ EDIT: I have a lot of these redirects (about 40) and was wondering if there is way to have 1 Rewrite rule - instead of