mod-rewrite

.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

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

mod_rewrite passing variables

假装没事ソ 提交于 2020-02-03 10:41:06
问题 I have the following mod_rewrite rule: RewriteRule ^([^/.]+)/?$ search.php?action=procedure&procedureName=$1 This works fine in redirecting things like /blabla to /search.php?action=procedure&procedureName=blabla The problem is that sometimes I want to pass a 'start' value (for pagination). For example, /blabla/?start=20. Currently, it just ignores it. Printing out the $_REQUEST array doesn't show 'start'. I tried modifying the rule to: RewriteRule ^([^/.]+)/\?start=([0-9]+)$ search.php

mod_rewrite passing variables

人盡茶涼 提交于 2020-02-03 10:40:05
问题 I have the following mod_rewrite rule: RewriteRule ^([^/.]+)/?$ search.php?action=procedure&procedureName=$1 This works fine in redirecting things like /blabla to /search.php?action=procedure&procedureName=blabla The problem is that sometimes I want to pass a 'start' value (for pagination). For example, /blabla/?start=20. Currently, it just ignores it. Printing out the $_REQUEST array doesn't show 'start'. I tried modifying the rule to: RewriteRule ^([^/.]+)/\?start=([0-9]+)$ search.php

ModRewrite with HTTPS [closed]

倖福魔咒の 提交于 2020-02-02 16:20:50
问题 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 7 years ago . I'm using the following mod rewrites to ensure not only canonical URLs, but also that the site is displayed using HTTPS: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} // It think the problem must be here --^ RewriteCond %{HTTP_HOST} ^rto12\.ca$ [NC] RewriteRule ^(.*)$ https://www

ModRewrite with HTTPS [closed]

青春壹個敷衍的年華 提交于 2020-02-02 16:20:07
问题 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 7 years ago . I'm using the following mod rewrites to ensure not only canonical URLs, but also that the site is displayed using HTTPS: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} // It think the problem must be here --^ RewriteCond %{HTTP_HOST} ^rto12\.ca$ [NC] RewriteRule ^(.*)$ https://www