.htaccess

.htaccess - redirect from www https to non www https

天大地大妈咪最大 提交于 2020-01-17 06:17:29
问题 I have .htaccess: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} RewriteCond %{HTTP_HOST} ^www\.(.+) [NC] RewriteRule ^(.*) http://%1 [R=302,NE,L] It works ok when I have redirection from (example): from http:// is redirect to correct https:// from http://www is redirect to correct https:// but when I have https://www. I don't have redirection and "non trusted connection". What I should change in my htaccess file? 回答1: Just redirect to https on

How to redirect everything after slash to domain before?

一个人想着一个人 提交于 2020-01-17 05:52:39
问题 This is what I'm trying to do: I want example.com/car/{whatever} redirected to example.com/{whatever} . For example, example.com/car/honda should be redirected to example.com/honda BUT if there is nothing after /car/ , then just leave it as that. How can i do that in .htaccess ? 回答1: Removing a prefix from a URL is pretty simple, just RewriteRule ^car/(.*)$ /$1 [R,L] In order to keep a special case, you must put it in front RewriteRule ^car/$ - [L] This rule says, if there is just car/ leave

Apache RewriteEngine - Rewrite anything that not exists to index.php

为君一笑 提交于 2020-01-17 05:51:05
问题 I'm really struggling now. First of all, i searched on Google and here, and none of the solutions found worked for me. I don't really have much time right now to completely dig into Apache docs for solid understanding of the RewriteEngine(will do later for sure). WHAT I NEED I need to handle special requests from our Google Adwords campaign, which look like this: http://website.com/something/%first_param%/%second_param%/%third_param% In my document root directory, i have index.php where i

htaccess and MVC routing

牧云@^-^@ 提交于 2020-01-17 05:03:42
问题 Well i started coding a mini MVC base that I can just use on client websites, which also uses the same type of router class as CakePHP. I currently have the url display like this: http://localhost/mvc/index.php?page=blog/viewall Which gets the controller and tells it the function, just like CakePHP index(), view(), and so on. Now, I'm not sure how I can make the url look like this with .htaccess http://localhost/mvc/blog/viewall I was trying to add this in the .htaccess file: RewriteRule ^(.*

htaccess Apache RewriteRule .asp to .php

旧时模样 提交于 2020-01-17 05:00:13
问题 I am trying to use RewriteRule in htaccess to permanently redirect this: http://www.example.com/store/scripts/prodView.asp?idproduct=240 to http://www.example.com/index.php?route=product/product&path=59&product_id=50 I have tried: Options +FollowSymlinks RewriteEngine On RewriteCond %{QUERY_STRING} ^idproduct=240$ [NC] RewriteRule ^store/scripts/prodView.asp$ index.php\?route=product/product\&path\=59\&product_id\=50? [L,NC,R=301] .htaccess is in the root Can anyone suggest where I may be

URL Rewrites create compatibility issue with AjaxToolkit

戏子无情 提交于 2020-01-17 04:49:28
问题 I'm using the latest AjaxControlToolKit v15.1.3 and using the ... ajaxtoolkit:calendarextender for popping up the calender tool on click. everything works fine enough till there. now, when i add the URL rewrite code on the web.config file, the pop up on click no longer happens. any specific edit on the code i need to update for both to work. Here is the URL rewrite code: <rewrite> <rules> <rule name="RewriteASPX"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll"> <add input="

How to change URL structure with htaccess?

狂风中的少年 提交于 2020-01-17 04:45:26
问题 I have downloaded and installed http://www.question2answer.org/ on my website on http://www.yourstartups.com/discussion/ (discussion sub-directory) Current url structure is like: example.com/index.php?qa=123&qa_1=why-do-birds-sing I want to change to /123/why-do-birds-sing (why-do-birds-sing is example query) Following is my htaccess: DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L]

How to change URL structure with htaccess?

懵懂的女人 提交于 2020-01-17 04:45:05
问题 I have downloaded and installed http://www.question2answer.org/ on my website on http://www.yourstartups.com/discussion/ (discussion sub-directory) Current url structure is like: example.com/index.php?qa=123&qa_1=why-do-birds-sing I want to change to /123/why-do-birds-sing (why-do-birds-sing is example query) Following is my htaccess: DirectoryIndex index.php <IfModule mod_rewrite.c> RewriteEngine On #RewriteBase / RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L]

htaccess redirection with querystring

隐身守侯 提交于 2020-01-17 03:14:27
问题 How can I redirect the following url http://test.com/changefile.php?filename=top-ranked-colleges to http://test.com/top-ranked-colleges.php using htaccess redirection. Anybody please help me. Thanks in advance. 回答1: Try this RewriteCond %{QUERY_STRING} ^filename=(.*)$ RewriteRule .* http://test.com/%1.php? [R=301,L] to change http://test.com/changefile.php?filename=top-ranked-colleges to http://test.com/top-ranked-colleges.php RewriteCond %{REQUEST_URI} ^/(.*).php$ RewriteRule .* http://test

Expanding friendly url, mod rewrite

拟墨画扇 提交于 2020-01-17 02:37:35
问题 I am using modx, which is a cms system. It has a friendly url-option and uses a .htaccess like this. # The Friendly URLs part RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] If makes the url look like: mysite.com/about and mysite.com/about/contact I'd like to expand this .htaccess, so I can write myste.com/about/2 without the page 2 actually existing. I'd like to have the ability to access this in a get-variable. Can this be