mod-rewrite

Dynamic subversion repos via subdomains (in Apache)

核能气质少年 提交于 2020-01-01 01:17:10
问题 I'm trying to set up a subdomain-to-repository translation in Apache. Example: foobars.domain.com -> /server/svnrepos/foobars I've tried to get this done with mod_rewrite : RewriteCond %{HTTP_HOST} !^www\.domain\.com$ [NC] RewriteCond %{HTTP_HOST} ^(www\.)?([^.]+)\.domain\.com$ [NC] RewriteRule ^/svn(.*) /svn/%2$1 [PT] However, this causes problems with basic svn operations; 'checkout' causes this pretty thing: $ svn co http://foobars.domain.com/svn svn: '/svn/foobars/!svn/vcc/default' path

mod_rewrite GUI?

拥有回忆 提交于 2019-12-31 08:35:13
问题 Anyone have a graphical tool for developing mod_rewrite rules. Ideally it would display a pipeline of rewrites and then when given an instance of a uri would show the transforms as the get applied. It's always a pain to get them setup just right so any way of making it easier would help. 回答1: For online testing of .htaccess (read: mod_rewrite) rules, try: http://htaccess.madewithlove.be/ It shows you what and how rules are applied to the input URL. 回答2: I think it’s quite hard to write one.

URL handling – PHP vs Apache Rewrite

我们两清 提交于 2019-12-31 07:49:28
问题 Currently I let a single PHP script handle all incoming URLs. This PHP script then parses the URL and loads the specific handler for that URL. Like this: if(URI === "/") { require_once("root.php"); } else if(URI === "/shop") { require_once("shop.php"); } else if(URI === "/contact") { require_once("contact.php"); } ... else { require_once("404.php"); } Now, I keep thinking that this is actually highly inefficient and is going to need a lot of unnecessary processing power once my site is being

URL rewrite to remove parameters

青春壹個敷衍的年華 提交于 2019-12-31 06:42:26
问题 I'm working on a site where all the pages are actually index.php + a 'name' parameter that is analyzed and loads the appropriate template and content. the homepage url is: http://www.some_site.com/?page=homepage 1. i was asked to "change" the homepage url to: http://www.some_site.com can i use url rewite and htaccess for that and if so, what should i write there? working on my local machine, i tried this code (mode rewrite is enabled): <IfModule mod_rewrite.c> Options +FollowSymLinks

URL rewrite to remove parameters

孤街浪徒 提交于 2019-12-31 06:42:22
问题 I'm working on a site where all the pages are actually index.php + a 'name' parameter that is analyzed and loads the appropriate template and content. the homepage url is: http://www.some_site.com/?page=homepage 1. i was asked to "change" the homepage url to: http://www.some_site.com can i use url rewite and htaccess for that and if so, what should i write there? working on my local machine, i tried this code (mode rewrite is enabled): <IfModule mod_rewrite.c> Options +FollowSymLinks

Mod_rewrite flat links

邮差的信 提交于 2019-12-31 05:29:06
问题 I'm trying to display my get variables as flat links. Want to change from this: http://mydomain.com/index.php?page=shop&var1=hat&var2=10 to http://mydomain.com/index.php/shop/hat/10 Please keep in mind that there isn't a fixed number of variables, that's why I use var1,var2,...etc [edit] I already have a partially working script, but works only with max 3 variables RewriteCond %{ENV:REDIRECT_STATUS} 200 RewriteRule .* - [L] RewriteRule ^([^/\.]+)/?$ index.php?page=$1 [L] RewriteRule ^([^/\.]+

.htaccess RewriteRule adds drive path to URL

烂漫一生 提交于 2019-12-31 05:12:34
问题 I am using Zend Server CE (v.5.1.0) installed on C: on a Win7 machine. I have added one project to httpd.conf by adding: Alias /project "D:\Homepages\project" <Directory "D:\Homepages\project"> Options Indexes FollowSymLinks AllowOverride all Order allow,deny Allow from all </Directory> My .htaccess file in the project directory contains the following: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_URI} ^/\w*\.(css|js) [NC] RewriteRule ^.*$ - [NC,L] RewriteRule ^.*$

Rewrite URL with .htaccess

爱⌒轻易说出口 提交于 2019-12-31 04:39:24
问题 I've this url: http://www.test.com/page.php?k=m1ns and I want this one: http://www.test.com/r/m1ns My .htaccess: Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^k/([^/\.]+)/?$ page.php?k=$1 [L] # force www. in all requests RewriteCond %{HTTP_HOST} ^test\.com [NC] RewriteRule ^(.*)$ http://www.test.com/$1 [L,R=301] # enable hiding php extension RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php But it doesn't work. Only the

How to deal with “#” in a query string in mod_rewrite?

狂风中的少年 提交于 2019-12-31 04:31:07
问题 I asked this question about rewriting old "ugly" links into seo friendly ones. I need to "extract" some information after the "sharp" symbol in some urls. I've created a regular expression to it but it can't seen to work. After my question, I created this logic for this url for example, script.php?mode=full&id=23 : RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /script\.php\?mode=full&id=([0-9]+)\ HTTP/ RewriteRule ^script\.php$ fix_old_urls.php?phpfile=script2&id=%1 [NC,L] But I'm working in a

mod_rewrite to absolute path in .htaccess - turning up 404

六月ゝ 毕业季﹏ 提交于 2019-12-31 04:26:09
问题 I want to map a number of directories in a URL: www.example.com/manual www.example.com/login to directories outside the web root. My web root is /www/htdocs/customername/site the manual I want to redirect to is in /www/customer/some_other_dir/manual In mod_alias, this would be equal to Alias /manual /www/customer/some_other_dir/manual but as I have access only to .htaccess , I can't use Alias, so I have to use mod_rewrite . What I have got right now after this question is the following: