mod-rewrite

.htaccess not working only with internet explorer

本小妞迷上赌 提交于 2019-12-12 19:24:13
问题 i have site, that has to rewrite site.ru and www.site.ru to www,site.ru/ru_RU. I can't access any Apache config files. In htaccess: Options +FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_HOST} ^site.ru$ RewriteRule (.*) http://www.site.ru/ru_RU [QSA] RewriteCond %{HTTP_HOST} ^www.site.ru$ RewriteRule (.*) http://www.site.ru/ru_RU [QSA] RewriteCond %{REQUEST_URI} ^/news RewriteRule (.*) /news [QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME

remove file extension htaccess not working

自闭症网瘾萝莉.ら 提交于 2019-12-12 19:18:45
问题 the following code is not working to remove the file extension .php Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.+)$ $1.php [L,QSA] my url not changing from example/about.php to example.com/about 回答1: I have found the answer. Its working. the code is as follows to rewrite and redirect the url Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On

htaccess rewriting URLs with multiple forward slashes

眉间皱痕 提交于 2019-12-12 19:18:21
问题 Trying to work out a set of .htaccess mod_rewrite rules that will set these links: domain.com/content-page domain.com/region/another-page domain.com/region/brand/more-content-here to fetch files: domain.com/content-page.php domain.com/region-another-page.php domain.com/region-brand-more-content-here.php Where 'region' and 'brand' and the page name are all variable/changeable. So far I have: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,C] RewriteRule (

Internal server error With RewriteRule

不问归期 提交于 2019-12-12 19:14:38
问题 I have a problem is when change the url of my site, which is generated dynamically. I have the Apache module mod rewrite localhost wamp server enabled. Before fundionaba perfectly, but before the php url used two variables now to remove one server fails. I do not understand why fails. Can you help me? It is very strange that server error when you click on these same links that worked previously. If there is a problem with the php variable or php error because it would, but not a server error.

Mod rewrite redirection to another domain if file not exist

拈花ヽ惹草 提交于 2019-12-12 19:00:13
问题 What I'm trying to do: I need to redirect a request to a file to another domain if the file not exists. For example: http://www.mydomain.com/js/foo.js redirects to (if not exists) http://www.myanotherdomain.com/js/foo.js What I do: I wrote the next lines at the end the htaccess, but they redirect ALL! RewriteCond %{REQUEST_URI} !-f RewriteRule ^(.*)$ http://www.myanotherdomain.com/$1 [L,NC] Before these lines, I have a lot of lines like this (I'm using MVC (Model, View,Controller)):

Mod_Rewrite Error 310 TOO_MANY_REDIRECTS

故事扮演 提交于 2019-12-12 18:35:23
问题 I want make pretty URL (contact.php?id=something to contact/something) with this code in .htaccess, but when I use it my browser displays error 310 - too many redirects. Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^contact/(.*)$ contact.php?id=$1 [L] RewriteCond %{QUERY_STRING} ^id=(.*)$ RewriteRule ^contact.php$ /contact/%1? [R,L] Can somebody help me, what is wrong? Thanks. 回答1: You problem is

How to redirect page with query-string to external webpage using APACHE RewriteRule

瘦欲@ 提交于 2019-12-12 18:25:09
问题 I am trying to redirect a login page to an external security service. This service, after validating the credentials, will then return user back to the originating page using the referrer url, as in the following example: http://{IP NUMBER}/MyWiki/index.php?title=Special:UserLogin&returnto=Main_Page or any call to a page in the site containing Special:UserLogin in the query_string needs to be redirected to: https://login.security.server.com/test/UI/Login?service=DSSEC&goto=http://{IP NUMBER}

How can I check if file exists in nginx? otherwise run a rewrite rule

北慕城南 提交于 2019-12-12 18:20:48
问题 good day everyone, In order to resize images on the fly, i have decided to use a service like Kraken or imgix. My images will be displayed as so: site.com/img/path-to-img-s250x250.jpg and what i would like to achieve is: if the image path-to-img-s250x250.jpg exists, then i'll display it, and if not then run an nginx rewrite rule to resize the original image and save it. Is this something possible or should i do the checks with PHP? Also do you have any better ideas on how to better deal with

mod_rewrite gives me 404

五迷三道 提交于 2019-12-12 18:15:00
问题 I wanna rewrite links like index.php?page=entry&id=15&action=edit to entry/15/edit . This is how my .htaccess looks like now: # Turn the Rewrite engine on RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f # Rewrite rules RewriteRule ^([^/]*)(/([^/]*)/?)([^/]*)?$ index.php?page=$1&id=$2&action=$3 [QSA,L] Gives me 404. What's the problem? 回答1: Too many parentheses. You might have a Lisp infection. Try: RewriteRule ^([^/]*)/([^/]*)/?([^/]*)?$ index.php?page

http to www while preserving subfolder?

流过昼夜 提交于 2019-12-12 18:10:55
问题 I have the following rule in .htaccess to redirect from domain.tld to www.domain.tld and it's working fine. RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] However, when trying to access domain.tld/forum , I get redirected to www.domain.tld How can I redirect all non-www to www while preserving whatever subfolder the visitor is in? 回答1: Use REQUEST_URI variable: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^ http: