mod-rewrite

Mod Rewrite Env Variables

Using this rudimentary example, I can't seem to get Environment Variables to 'take' SetEnv APPLICATION_ENV production RewriteEngine On RewriteCond %{ENV:APPLICATION_ENV} =production RewriteRule ^loading$ /images/loading.gif [NC,L] for some reason going to /loading does not show the loading.gif I have tried many permutations of th...

.htaccess - Pretty User Profile URLs

I want to make my user profiles 'pretty' as it were. Here is the regular URL: user.php?user=UserName I want this to become: user/Username Please help :) Im a .htaccess newbie. ...

RewriteRule with onClick problem

Hello, I have a RewriteRule in my site and it's working fine but 1 part of my javascript doesn't work. <a href="#" onClick="check('1')">Click</a> <div id="1" style="padding: 5px; display: none;"> MyText </div> normaly i had www.mysite.com?page=home and when i click it work like www.mysite.com?page=home# but with the RewriteRule...

Problem using URL rewrite (Relative Paths not working)

Hi I am using a .htccess file in order to rewrite my URLs. I am using the following rules in my .htaccess files Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteRule ^product/([0-9]+)/([A-Za-z0-9+]+)$ /product.php?productid=$1&prodname=$2 The rewrite worked fine. But when i try to access any other page through relative...

Page anchor with mod_rewrite?

I'm trying to set up page anchors on a website that uses mod_rewrite (Apache2 running on Ubuntu Server 9.04). My htaccess file looks like this: RewriteEngine On RewriteRule ^information.php/([A-Za-z0-9-]+)/?$ information.php?display=$1 [NC,NE] If I was using regular URL's the query would look something like this: http://mydomain/info...

.htaccess Question

I have pages like this: page.php?id=1&name=whatever How could I transform this into... page/1/whatever ? ...

.htaccess not working (mod_rewrite)

I have not having any luck getting my .htaccess with mod_rewrite working. Basically all I am trying to do is remove 'www' from "http://www.example.com" and "https://www.example.com". If there is anything I am missing (conf files, etc let me know I willl update this) Here is my .htaccess file (located @ /var/www/site/trunk/html/) Opti...

make server auto-append @domain.com to ftp account

I have a client who, printed 10,000 advertisements with a specific password for an FTP account written on it lets say: horses1, for many reasons I have had to migrate her over to a new host, she chose mediaTemple, and bought an account. The Login is now [email protected], which is a problem, becuase of all her print ads. I'm think...

mod_rewrite for any number of variables

I am a newbie to mod_rewrite and I was wondering if there is any way you could make on rewrite script that handles and number of variables you throw at it. Example: www.krisnicolaou.com/index.php?id=5&sort=asc&limit=25&param=first_name to www.krisnicolaou.com/5/asc/25/first_name ...but, you can also pass these variables in on another ...

Htaccess URL rewrite question

I have a challenge using Apache. In my .htaccess file I'd like to convert requests like this: url/portfolio/filename.htm to: url?filename Any takers? Thanks for your time ...

fixing cakephp .htaccess/mod_rewrite for shared hosting setups

I'm trying to install cakePHP on a shared hosting setup. After extracting the files to a location like ~/public_html/dev/cake and visiting the appropriate URL (in this case http://hostname/~username/dev/cake/), I receive a 404 error: Not Found The requested URL /usr/home/username/public_html/dev/cake/app/webroot/ was not found on thi...

Mod_Rewrite rule not working on production server

Hi Guys, I've been trying without success to get a rule working on my production server that works fine on my WAMP server on my local machine: RewriteEngine On RewriteCond %{REQUEST_FILENAME} -f RewriteRule \.exe /download/ [L] On my local server it redirects all direct file download requests to /download/ but on the pr...

Internal subdomain to folder redirect

I want to create folders on the fly, but make it seem like I am creating subdomains on the fly using mod_rewrite. e.g. Create "john" folder using PHP www.example.com/john/ Then be able to access whatever I put in there at: john.example.com Thank you in advance, Kris ...

Rewrite a request whether or not the requested file exists

I'm trying to convert all requests in the format: /portfolio/picturename.htm ('portfolio' is constant) to this: /?picturename So (thanks to users here) I have this solution which works for files that don't exist: Options +FollowSymlinks RewriteEngine on RewriteRule ^portfolio/(.+)\.htm$ /?$1 [R,NC,L] But: How do I also have th...

Apache .htaccess file redirect

Should be easy for someone. My files are in this directory: /user/home/peter/mygame/production/ I am required to access my site using: www.foo.com/peter (which brings me to /user/home/peter/) How do I tell apache: www.foo.com/peter reads from /user/home/peter/mygame/production/ Thanks. ...

How can I redirect every URL that's not requesting an JPEG or PNG image to index.php/x?

For example, I have an URL that looks for an image like this: http://example.com/img/foo.png http://example.com/img/interface/menu/bar.png http://example.com/static/users/avatars/small/3k5jd355swrx221.jpg I don't want to redirect those. They should just pass through. But then, I have URLs like this: http://example.com/reg...

mod_rewrite adding unwanted file extension

I set up Phorum to use search-engine friendly URLs on my local server (Ubuntu Jaunty). It worked perfectly. Upon moving the site to the production server (Gentoo), I get 404 not found for all pages. The mod_rewrite logs below show the problem. The same rules are being used on both installs: RewriteEngine On # READ RULES RewriteRule ^(...

Pretty URLs without mod_rewrite, without .htaccess

Without a possibility to access .htaccess I find myself in a creative impasse. There is no mod_rewriting for me. Nevertheless, I want to be able to do the nice stuff like: http://www.example.com/Blog/2009/12/10/ http://www.example.com/Title_Of_This_Page What are my alternatives? In respond to the answers: I'm building with php5 I ...

using apache's mod_rewrite to parse SEO friendly URL's

Hi - How do I convert something like me.com/profile/24443/quincy-jones to me.com/profile.php?id=24443 or something like me.com/store/24111/robert-adams to me.com/store.php?id=24111 with mod_rewrite? Can I make the reverse conversion as well with mod_rewrite, or would I have to parse it through PHP? ...

How to reference the current directory from .htaccess using mod_rewrite?

I'd like to use mod_rewrite to make pretty URLs, but have a single version of the .htaccess file that can be used for any user on a server. So far I have the standard pretty URL .htaccess: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ /index.php/$1 [L] Ideally, I would...