mod-rewrite

Creating simple URL's (.htaccess - mod_rewrite)

I have this structure for my navigation index.php?v=page I am looking to convert it to: www.domain.com/page/ - using mod_rewrite..any ideas on that? I read through some tuts and examples, but couldnt get it working right. Thanks, Ryan ...

Apache mod_rewrite %2B and plus (+) signs...

I'm using apache / mod_rewrite to re-write URLs but I am having problems with the plus sign. With the following rule.. RewriteRule ^/(.+[^/])/?$ http://localhost:8080/app/home?tag=$1 [P,L] Both: http://localhost/1+1 and http://localhost/1%2B2 end up as uri=http://localhost:8080/app/home, args=tag=1+2 So in both cases the appl...

mod rewrite and automatic redirection

Hello! I have this rule written in my .htaccess: RewriteRule ^blog/([0-9]+)/? /obdelaj.php?ime=$1 Which works but it redirects me to example.com/obdelaj.php?ime=# and I want the user to stay on example.com/blog/# I have a hostgator account and I don’t have access to the httpd file, and I presume that a some configuration in httpd fi...

Rewrite Query String

Hello, I am trying to write some mod_rewrite rules to generate thumbnails on the fly. So when this url example.com/media/myphoto.jpg?width=100&height=100 the script should rewrite it to example.com/media/myphoto-100x100.jpg and if the file exists on the disk it gets served by Apache and if it doesn't exist it is called a script t...

How would I redirect two domains using .htaccess

I'm trying to redirect one domain to the root and another to a directory. The problem I'm having is the second domain is overwriting the firsts redirection. Here is what I have. RewriteEngine On RewriteCond %{HTTP_HOST} !^http://example.site.net$ [NC] RewriteCond %{REQUEST_URI} !^/.*$ RewriteRule ^(.*)$ / [L] RewriteEngine On Rewri...

how do I redirect from a subdirectory to another directory, but strip off the original subdirectory from the URI using mod_rewrite

I have a Ruby on Rails app running on 12001. I am currently redirecting a subdomain to 127.0.0.1:12001 using some ReWriteCond detection. Now I want to redirect my subdirectory to that rails app. http[s]://domain.com/redmine to 127.0.0.1:12001 The current rules apply REQUEST_URI to the above rails path, but I need to strip "/redmine...

Forcing the www prefix with PHP/htaccess/mod_rewrite

Is there an easy way (preferably with htaccess and mod_rewrite) to force the browser to always access a site with the www. prefix (adding it automatically where necessary?) Thx. ...

Dynamic mod_rewrite or how to plan a dynamic website

Hi, I'm trying to make a clean url for a blog on a dynamic website, but I think that the problem is that I don't know how to plan the website schema. I read about how to use mod_rewrite and all I found is how to make "http://www.website.com/?category&date&post-title" to "http://www.website.com/category/date/post-title". that's ...

having trouble with a mod_rewrite rule

want to rewrite urls like site.com/software to wp-content/themes/dir/software.php and something is not working.. Here's what I have: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] RewriteRule ^software wp-content/themes/dir/software.php [L] Thanks! ...

How to successfully Rewrite a URL with .htaccess

Hello. I am trying to rewrite mysite.com/broadcasts to mysite.com/feed so that it will show up in the location bar as "broadcasts" but actually go to /feed. Here is what I have in the .htaccess file: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^broadcasts(/)?$ /feed/ </IfModule> But this isn't working... I get a 4...

Debugging mod_rewrite

I'm playing around with Apache's mod_rewrite module, and want to know if there is a decent way to output some debugging information? For example, the documentation lists a number of variables available: %{HTTP_USER_AGENT}, %{HTTP_REFERER}, %{HTTP_COOKIE} ... etc Is there a way I could output these just to see what I'm working with? I ...

How to setup .htaccess to rewrite to different folder

I'm moving my site to a new host but I need to have my current server continue to handle requests (not all files can be moved to the new server). So I added a parked domain to my old server (old.mydomain.com) and I want all requests to it to be written to the files from the old site. My old site (mydomain.com) was hosted internally in a...

PHP: Best solution for links breaking in a mod_rewrite app

I'm using mod rewrite to redirect all requests targeting non-existent files/directories to index.php?url=* This is surely the most common thing you do with mod_rewrite yet I have a problem: Naturally, if the page url is "mydomain.com/blog/view/1", the browser will look for images, stylesheets and relative links in the "virtual" directo...

How should i change the root for mod_rewrite url when i work in localhost

I am working on a site maintainence. It uses mod_rewrite technique. But im new to mod_rewrite. How should i change the url to work correctly in my localhost. here's the code: # Enable mod_rewrite, start rewrite engine Options +FollowSymLinks RewriteEngine on rewritecond %{http_host} ^electricians4u.com.au [nc] rewriterule ^(.*)$ htt...

Why is my .htaccess file redirecting to full server path instead of relative path?

I've never had a problem with cakePHP before, but something's odd about this server and is causing the redirects in the .htaccess files to behave oddly. CakePHP uses mod_rewrite in .htaccess files to redirect requests to its own webroot folder. The problem is that the redirects are listing the wrong path and causing a 404 error. My Cake...

redirect into subdirectory AND out of subdirectory

hi folks i have a mod_rewrite redirection problem i cannot figure out. all requests from a specific domain get "silently" rewritten into a designated subdirectory. e.g. www.mydomain.net/hello.html retrieves the file in /net/hello.html. the following .htaccess (placed in my hosting root) achieves this perfectly: RewriteEngine on Rewrit...

Allow access to one directory with htaccess?

I have the following code which works perfectly, but I want to allow access to the /assets directory? Options +FollowSymlinks RewriteEngine On RewriteRule ^.* controller.php AddHandler php5-script .php Could someone give me a little line of code or two to help? ...

Problem in apache2 with mod rewrite when setting rules in .conf files instead of .htaccess

Hi, Because of weird security policies of my hosting provider I have to define my rewrite rules in /etc/apache2/conf.d/examplesite.conf instead of writing them on an .htaccess on the www folder of that site. What I'm trying to do is setup a Wordpress Mu server (http://mu.wordpress.org/forums/topic/17349 ) and so far its working on a 50...

Needs some help with an apache mod-rewrite issue

I've modified my .htaccess file to have the following statement RewriteCond $1 !^index.php$ RewriteRule ^/?([^/]+)$ index.php?c=home&m=details&seo=$1 [L,NS] This allows me to use product URL's like this: http://domain.com/product_name However, when trying to access a file at the same level as index.php, it always calls the RewriteRul...

mod_rewrite and google adwords

I have this rule in .htaccess to simplify the urls: RewriteRule ^([a-z]+)$ wp-content/themes/dir/$1.php [L] It works and creates nice-looking urls, however Google Adwords doesn't like it, gives an Invalid HTTP Response Code error on a link to one of the pages. Any ideas? ...