mod-rewrite

Mod-rewrite Trailing Slash Issue

China☆狼群 提交于 2019-12-12 10:49:11
问题 There doesn't seem to be much info on this topic so I'm going to outline my specific problem then maybe we can shape the question and the answer into something a bit more universal. I have this rewrite rule RewriteEngine On RewriteBase /bookkeepers/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.+)/?$ index.php?franchise=$1 Which is changes this URL http://example.com/location/kings-lynn Into this one http://example.com/location/index.php?franchise

Codeigniter web.config or .htaccess index.php rewrite inside a subdirectory

柔情痞子 提交于 2019-12-12 10:45:19
问题 my website folder structure is like below... Application Root |- administration |--|- application |--|- system |--|- index.php |--|- web.config | |- application |- system |- index.php |- web.config Two CI framework installed here. site root administration folder Here I am talking about the administration subfolder. My web.config URL Rewrite is like below. <rules> <rule name="Rewrite to index.php"> <match url="index.php|robots.txt|images|test.php" /> <action type="None" /> </rule> <rule name=

Customized .htaccess url

蹲街弑〆低调 提交于 2019-12-12 10:21:18
问题 this code in below work fine old code RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-d #####exclude /cp folder#### RewriteCond %{REQUEST_URI} !^/cp RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /((?!cp)[^.]+)\.php RewriteRule ^/?(.*)\.php$ /$1 [NC,L,QSA,R=301] RewriteRule ^singer/(.*)$ singer.php?s=$1 [NC,L,QSA] RewriteRule ^album/(.*)$ album.php?a=$1 [NC,L,QSA] RewriteRule ^lyric/(.*)$ lyric.php?l=$1 [NC,L,QSA]

.htaccess redirect to language subfolder

自作多情 提交于 2019-12-12 10:12:58
问题 What I have: there are two languages installed: German and English language-versions are managed with subfolders (www.domain.com/de/ and www.domain.com/en/) machine: Typo3 4.5.4 / RealUrl installed mod_rewrite is enabled an works What I want to do: redirect requests without language subfolder to the German version e.g. domain.com/any/test/folder/ to domain.com/ de /any/test/folder What I tried: RedirectMatch permanent ^/(?!(?:(?:de|en)/))(.*)$ /de/$1 Occuring problems: all requests were

Load new site from subdirectory as index

爷,独闯天下 提交于 2019-12-12 10:06:50
问题 I want to load my new website from subdirectory including default index.html page. In my public_html, I have /oldsite/ and /newsite/ folders... Then.. When I access to http://www.mysite.com/.. i want it to load all contents from http://www.mysite.com/newsite/ without redirecting. I want to do it with .htaccess mod_rewrite if possible.. Can anybody help me out with this. How to do this? 回答1: # to ensure that server already know that you going to use mod-rewrite RewriteEngine on # if the

Redirect with htaccess for images onto another server without redirect looping

戏子无情 提交于 2019-12-12 10:01:40
问题 I currently have a host where my main site is hosted on. I have set up nginx on another server to mirror/cache files being requested if it doesn't have it already, in particular images and flv videos. For example: www.domain.com is my main site. www.domain.com/video/video.flv www.domain.com/images/1.png I would like to ask apache to redirect it to imgserv.domain.com (imgserv.domain.com points to another server IP) imgserv.domain.com/video/video.flv imgserv.domain.com/images/1.png Basically

mod_rewrite : if / else type RewriteRule

会有一股神秘感。 提交于 2019-12-12 09:47:33
问题 The following rewrite passes a string starting with the number 4 as a variable to process.php : RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(4[^/]*)$ /process.php?variable=$1 [L] So this http://www.domain.com/4shopping is mapped to http://www.domain.com/process.php?variable=4shopping But I want to extend this last rewrite rule to basically state: if word begins with 4, map to /process.php?variable=$1 else map to /index.php The second (else) part of

How can I redirect all sub-directories to root using htaccess or httpd.conf?

好久不见. 提交于 2019-12-12 09:44:16
问题 I have an index file that builds content based on n PATH_INFO variables. Example: site.com/A/B/n/ should use index.php at either: site.com/index.php?var1=A&var2=B&varN=n - or - site.com/index.php/A/B/n/ instead of: site.com/A/B/n/index.php || which doesn't exist || So far I've tried a number of variations of: RedirectMatch ^/.+/.*$ / with no success. I have an inelegant and unscalable solution here: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?p1=$1 [NC,L] RewriteRule ^([a-zA

How do I make mod_rewrite suppress processing more rules?

99封情书 提交于 2019-12-12 09:41:06
问题 Given my current .htaccess file, how would I modify it to check for an additional URL path like '/src/pub/ ' and rewrite it to '/ ' without affecting the current rewrite? Here's the original .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?route=$1 [L,QSA] and here's my recent attempt (which doesn't work): RewriteEngine on RewriteRule ^/src/pub/(.*)$ /$1 [R] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %

Subdomain to folder htaccess

▼魔方 西西 提交于 2019-12-12 09:25:45
问题 I am trying to point sub.domain.com to domain.com/app/*sub, but the farthest I can get is making it a redirection and I do not want it to redirect. Here is what I have, it works but it redirects it instead of staying on the subdomain, which is what I want. RewriteCond %{HTTP_HOST} ^(.*).example.com RewriteCond %{HTTP_HOST} !^www.example.com [NC] RewriteRule ^(.*)$ http://example.com/app/%1/$1 [L] 回答1: You must either redirect or force proxy behavior. See also ProxyPass and ProxyPassReverse.