Questions tagged [mod-rewrite]

mod_rewrite is a URL rewriting module for the Apache web server. It is commonly used for so-called "pretty" URLs because of its ability to redirect on the server side (transparent to clients and their browsers), but also provides the power and flexibility to perform various request handling tasks beyond simple substitutions.

636 questions
5
votes
1 answer

mod_rewrite rule for wildcard subdomains?

Sorry if this has been covered, I can't find anything on this specifically. I have wildcard subdomains on (*.mysite.com) I need a mod_rewrite expression for this rewrite: bob.mysite.com => mysite.com/users/index.php?user=bob bob.mysite.com/profile/…
user745668
  • 53
  • 2
  • 4
4
votes
1 answer

Need to create a rewrite rule that will check certain characters in a query string variable and redirect it to another page

Need to create a rewrite rule that will check certain characters in a query string variable and redirect it to another page. Example: http://www.example.com/index.html?test=123$4/56 I should be able to capture this request and redirect to 403 page.…
Alabios
  • 43
  • 1
  • 3
3
votes
1 answer

RewriteRule for URLs with spaces

My site's pages are in multiple languages whereby each language version shares its media (images) with the other language versions. I place all versions and the media in a single directory with the same name. E.g. pages mypage-en.html,…
3
votes
3 answers

mod rewrite condition !-f being violated

I am using Wolf CMS, which is served by PHP. I want to redirect /index.html to /index.php. I put the following in .htaccess: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} ^index.html$ [NC] …
Steve
  • 1,456
  • 3
  • 18
  • 38
3
votes
1 answer

Setting Content Type with mod_rewrite

I have the following mod_rewrite rule: RewriteRule ^/yui-3.3/yui_config.js$ /web/yui/yui_config.js [R] when looking at the network traffic with Firebug and Chrome I noticed that /yui-3.3/yui_config.js reports its type as text/html which obviously…
Walter Rumsby
  • 131
  • 1
  • 5
2
votes
2 answers

Crafting a regex for mod_rewrite with more than nine parameters

Say for example, I have a URL in this format: http://example.com/(mobile-or-desktop-flag)/(major-venue-category)/(smaller-venue-category)/(venue-name)/(month)-(day)-(year)/(picture-number)/(user-action-on-picture)/(request-ajax-or-not) where the…
Mike -- No longer here
  • 13,610
  • 4
  • 28
  • 60
2
votes
0 answers

Passthrough in Virtualhost not preserving the previous URL

I have a RewriteRule written at Apache to redirect to TOMCAT. Passthrough [PT] doesn't seems to work and Getting Bad Request. Same configuration works with [P], but I don't want tomcat PORT to be visible in the browser. If I enable ProxyPreserve…
2
votes
1 answer

Using Mod_Rewrite To Block Referrer Based On Domain Extenstion?

I've been in web development for several years now (I'm a student web designer), and recently, I've begun to experiment with mod_rewrite for things like URL shortening. I was wondering, is it possible to block a referrer by domain extension,…
Matt
  • 21
  • 2
2
votes
1 answer

unable to move 5million URL from forum/abc/ to forums/abc/

I had a forum with /forum but it has changed to /forums I want to know if there is a single line code which can redirect my old URL to new ones. It is not simple redirection from /forum to /forums The URL after /forum/abc.html are now…
1
vote
0 answers

Mapping different users to folders with mod_rewrite

I'm setting up a DAV server with Apache 2.2 and would like, if at all possible, to be able to redirect a user to their own folder without having per-user URLs, if at all possible. So I point a user to https://dav.example.org/, I have authentication…
Callie J
  • 111
  • 3
1
vote
1 answer

Mod Rewrite - url rewriting

I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url for example…
0
votes
1 answer

Using mod_rewrite to rewrite URLs with question marks in them

This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time I interact with it. A long time ago when I set up my blog and podcast, I didn't yet grasp the whole concept of…
Donald Burr
  • 103
  • 4
0
votes
1 answer

mod_rewrite prevent repeating backreference

I am trying to match a single reference in a URL to pass to a script, while retaining the rest as the path to the script. For example: #/scripts/paramater/foo/bar.php should call #/scripts/foo/bar.php?id=parameter RewriteRule ^scripts/([^/]+)/(.*)$…
Tak
  • 123
  • 7
0
votes
1 answer

Mod RewriteRule not working on all URL's

this is my .htaccess Options +FollowSymLinks RewriteRule ^(.*)wp-content/uploads/(.*) $1watermark.php?src=wp-content/uploads/$2 # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond…
Brad
  • 1