mod-rewrite

Pointing a subdomain to a subfolder using .htaccess

My webhost automatically forwards all requests to *.mydomain.com to the toplevel domain mydomain.com. I wanted to map any subdomain to a specific folder on my toplevel domain. i.e. sub.example.com must be mapped to example.com/someFolder (without change in the address bar). After digging around on the net, I came up with this: Rewrite...

Rewrite URLs for static content

I have problems with static files url rewriting in current .htaccess setup on apache2. My app structure is: /siteroot /siteroot/app /siteroot/lib /siteroot/... /siteroot/public <- all the static files (images, js, etc.) stored here /siteroot/index.php /siteroot/.htaccess So, i need to rewrite url like /css/style.css to /public/css/st...

Reaching files outside od the documentroot scope

Hi. I'm writing a script to build a dynamic website, the website is created by loading external components. The DocumentRoot is location at /sites/website/public the components directory is located at /sites/website/components i wannna reach the data directory of each component depends on the requested url. for example: the url: htt...

mod_rewrite: periods from URI gone in the query string

Problem: See examples below. When using mod_rewrite to put "the URI part after the script name" into the query string (in any way), the ending periods (.) of every "directory" are removed. (Apache 2.2.14 on win32.) Question: Is there any way to solve this or do I have to parse REQUEST_URI? Request ("."s escaped): http://localhost/simp...

How can I alias a path to another without the user knowing that path?

I thought I could do this with rewrite but I can't seem to find any information on it. What I want to do is this. /path/to/my/program/index.php I want to use a link for the use such as. /forum/index.php Is this posible? ...

how to? mod_rewrite in different .htaccess files per folder move into vhost.conf - mvc

Hi there, I hope I will find a help here. I have a quite complex MVC driven application. Here how it works: these are my directories / - (/dispatcher.php as mvc1 app bootstrap) /mvc2 - (/mvc2/dispatcher.php as mvc2 app bootstrap) /mvc3 - (/mvc3/dispatcher.php as mvc3 app bootstrap) all 3 are accesible under one domain example.com...

mod_rewrite passing variables

I have the following mod_rewrite rule: RewriteRule ^([^/.]+)/?$ search.php?action=procedure&procedureName=$1 This works fine in redirecting things like /blabla to /search.php?action=procedure&procedureName=blabla The problem is that sometimes I want to pass a 'start' value (for pagination). For example, /blabla/?start=20. Currently,...

Redirect all page requests to one page

I need to redirect all page requests (php, if that matters) on a specific domain to a specific page (again, php) on that domain. I'm looking for a .htaccess, mod_rewrite solution for easy of implementation. ...

htaccess redirect from /foo/bar/mydocument.doc to /foo/bar/auth_test.php?q=mydocument.doc

I've got a Web site with a bunch of docs and pdfs in /foo/bar/ Directory browsing is turned off, so you have to know the specific URL/URI combo to get the document. I'd like to find a way of redirecting ALL requests to /foo/bar/ to a php page that checks their auth cookie is set and, if so, gets their file. Of course, I also need the ...

Mod_rewrite htaccess question.

How could I take a URL like http://example.com/page.php?2342 And turn it into http://example.com/page/?2342 or is that not possible? ...

Is it possible to have htaccess if else type rewrite conditions and rewrite rules?

I am trying to write an htaccess file that essentially does this: if(requested file == "some-file.php" || requested file == "some-file2.php" || requested file == "some-file3.php") then Rewrite to redirector.php?uri=some-file.php <- substitute requested file without passing any parameters else // existing rewrite conditions from silve...

how do i fix this rewrite URL rule ?

basically need to convert with www or not, example.com/[anycharacter] into with www or not, example.com/cgi-bin/new-disk.cgi/dir/smooth/[anycharacter] additinoally... i would like to redirect ALL www.example.com into example.com ...

A universal mod-rewrite htaccess file for my script

I'm writing a script that (I hope) will be widely distributed and I want make sure that it will work on as many servers as possible out of the box. This script will require an .htaccess file but I've learned some htaccess files are not very portable. The htaccess needs to do a simple redirect, like so: http://example.com/dir/string R...

Request exceeded the limit of 10 internal redirects due to probable configuration error. ??

i have a simple rewrite RewriteRule ^.*$ addnew/$0 however i get the Request exceeded the limit of 10 internal redirects due to probable configuration error. I am trying to rewrite www.mysite.com/anycharacter into www.mysite.com/addnew/anycharacter ...

.htaccess mod_rewrite question

If I have a url http://example.com/page.php but I want the page to display when someone goes to http://example.com/page/ how do I go about doing that? ...

mod_rewrite for specific dynamic pages

I have some old product pages showing up in search for a redesigned site. The old pages are like this: www.site.com/mycart/index.php?act=viewProd&productId=34 I have static pages that I want these to go to. so I want redirect 301 /mycart/index.php?act=viewProd&productId=34 http://www.site.com/prod-name1 I know I can't do this with ...

need to rewrite ANY character (@#%^&*! /)

RewriteRule ^[^/.]*$ new/$0 everytime i type mydomain.com/somepath/to/somewhere it throws 404 its supposed to translate to : mydomain.com/new/somepath/to/somewhere ...

whats wrong with this redirect rule ?

RewriteCond %{REQUEST_URI} !^/?cgi-bin/nph-proxy.cgi/000100A/http/ RewriteRule (.*) /cgi-bin/nph-proxy.cgi/000100A/http/$0 i am trying to redirect www.myproxysite.com/somedomain.com/somedir/specialchar to www.myproxiste.com/cgi-bin/nph-proxy.cgi/000100A/http/somedomain.com/somedir/specialchar instead it keeps going to www.myproxi...

why doesn't this rewrite the url properly ?

RewriteCond %{REQUEST_URI} !^/?new.php?url RewriteRule ^/?(.+)\.?(.+)$ new.php?url=$0 [L] its supposed to take any URL mysite.com/someurl and convert it to new.php?url=someurl however it keeps going to just new.php ...

need a regex to match URL (without http, https, ftp)

just need a regex to match URLs without http , https, ftp in the beginning. basically i need it for mod rewrite examples: www.someurl.com/blah/blah/balh/etc/and/so/on crazy.something.net/agjja something.us/index.php? so i can do RewriteCond %{REQUEST_URI} URLregexhere RewriteRule ^URLregexhere$ ping.php?url=$1 [L] ...