url-rewriting

Dynamic URL rewrite using .htaccess

若如初见. 提交于 2019-12-11 01:41:53
问题 I am pretty new to .htaccess rewrites, and I'm trying to create rules to dynamically rewrite the URLs. For example, say the user enters the following URL: http://example.com/xxx/?user=2002 It would be rewritten into: http://example.com/xxx/user/2002/ If user passes multiple parameters like this: http://example.com/xxx/?user=2002&activity=100&result=true It should become: http://example.com/xxx/user/2002/activity/100/result/ Note: All the query strings will be dynamically generated. This is

IIS 8.5 URL Rewrite force redirect http --> https for non www

二次信任 提交于 2019-12-11 01:35:35
问题 I am starting with the rewrite module have a problem with a "simple" IIS 8.5 URL Rewrite redirect http --> https for a non www site. Problem: If the domain matches the action url parameter i always get "http://" and not "https://". This is my rule: <rewrite> <rules> <rule name="Redirect to HTTPS" stopProcessing="true"> <match url="(.*)" /> <conditions> <add input="{HTTPS}" pattern="^OFF$" /> </conditions> <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" redirectType="Permanent" /> <

Remove index.php from Joomla! URLs with NGINX

前提是你 提交于 2019-12-11 01:15:59
问题 How do I remove index.php from my Joomla URLs? For example: http://domain.com/index.php/webpage should become http://domain.com/webpage I've been following some guides that I've found but it all result in a redirect loop, 404 or internal server error. I need some guidance please. Here is my current config (excluding failing attempts). server { listen [::]:80; server_name www.domain.com; return 301 http://domain.com$request_uri; } server { listen [::]:80; server_name domain.com; root /usr

PHP how to get current rewrited URL excluding querystring?

点点圈 提交于 2019-12-11 01:06:28
问题 I am using the following URL rewriting in .htaccess. Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^([0-9]+)/([a-zA-Z0-9\&_,-]+)$ business/business_home.php?business_id=$1 [L,QSA] RewriteRule ^([0-9]+)/([a-zA-Z0-9\&_,-]+)/(about)$ business/business_about.php?business_id=$1 [L,QSA] RewriteRule ^([0-9]+)/([a-zA-Z0-9\&_,-]+)/(products)$ business/business_products.php?business_id=$1 [L,QSA] RewriteRule ^([0-9]+)/([a-zA-Z0-9\&_,-]+)/(enquiry)$

IIS 7.5 – a breaking change in extensionless URIs handling after Windows Server 2008 R2 SP1 is applied?

别来无恙 提交于 2019-12-11 00:57:05
问题 We are experiencing a problem with an application we recently migrated from IIS 6 .net 2.0 to IIS 7.5 .net 4.0 (ASP.Net Web Forms) The code performs custom rewriting in the global.asax Application_BeginRequest event and uses the HttpContext.Current.RewritePath() method to do the re-writing. When a bad request (a page which does not exist) with an extension comes in like /kentest/test.blah things are handled properly - IIS properly passes in the custom error page which we re-direct to. When a

Nginx Config Location Regex With Language Code In Url

南楼画角 提交于 2019-12-11 00:45:32
问题 Trying to achieve constant language code in url's 1st segment with nginx regex location configuration and could not find the correct syntax. Necessary result: example.com stays example.com example.com/en stays example.com/en example.com/en/ stays example.com/en or example.com/en/ (don't care) example.com/en/etc stays example.com/en/etc example.com/etc changes to example.com/en/etc example.com/etc/segment changes to example.com/en/etc/segment Currently I have found out this code but it still

What does the single dot do in this .htaccess RewriteRule?

核能气质少年 提交于 2019-12-11 00:43:50
问题 Using Wordpress as a CMS, the .htaccess file looks like this: RewriteEngine On # 1. ok - enables engine RewriteBase /blog/ # 2. ?? - sets blog directory as base for the rules RewriteRule ^index\.php$ - [L] # 3. ?? - replaces index.php by nothing in the URL RewriteCond %{REQUEST_FILENAME} !-f # 4. ?? - checks if request contains a file name RewriteCond %{REQUEST_FILENAME} !-d # 5. ?? - checks if request contains a directory name RewriteRule . /blog/index.php [L] # 6. ?? --> why this single dot

disable https for single page with htaccess

只愿长相守 提交于 2019-12-11 00:42:43
问题 I have tried some htaccess senteces but it doesn't work for me. I need to use whole site with https except one page it requires http connection from another site so i need to disable https for this page. Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L] RewriteCond %{HTTPS} on RewriteCond %{SCRIPT_FILENAME} \/exp\.php [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,NC] browser says it seems there is too many

Removing the .php file extension from the URL Request

旧时模样 提交于 2019-12-11 00:36:35
问题 I am trying to beautify my URLs and want to get rid of the .php file extension. I've found a couple of other questions here such as this one (Removing the PHP file type extension) But none of the suggestions work for me. They send me to my 404.php or do not change the URL at all. I figure the entire RewriteEngine code in my htaccess as a whole is conflicting in itself. Here's what I got so far, <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP_HOST} !^www.example.com$ [NC]

.htaccess allow only from Chrome, Opera, Mozilla, Safari, redirect from others

£可爱£侵袭症+ 提交于 2019-12-11 00:33:32
问题 I want to configure redirect if the user doesn't use Chrome, Safari, Opera or Mozilla. For inverse problem (if I don't want Chrome etc.) there is a solution: RewriteCond %{HTTP_USER_AGENT} Chrome RewriteRule ^abcd.html$ chrome.html [NC,L] RewriteCond %{HTTP_USER_AGENT} Safari RewriteRule ^abcd.html$ safari.html [NC,L] Adding ! before doesn't work 回答1: Negation is done using the ! operator. Using the [NC] flag will also discard strings like chrome , chRome etc: RewriteCond %{HTTP_USER_AGENT}