Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 8354

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.

1 vote
Accepted

mod_rewrite prevent repeating backreference

Easy: add condition that will prevent execution of rewrite rule on already rewritten URL. I see 2 main approaches (based on your URL examples): 1. Will prevent rewriting if URL was already rewritten …
LazyOne's user avatar
  • 4,929
1 vote

URL rewrite to fix broken links into a subdirectory -- subdirectory was moved to the root di...

The rules below will redirect (301, permanent redirect -- will change address in URL bar as well) all incoming requests from http://www.example.com/beta/ to http://www.example.com/ # activate rewrite …
LazyOne's user avatar
  • 4,929
4 votes
Accepted

just another mod_rewrite question

This rule will redirect (301 Permanent Redirect) all incoming requests to xxx.yyy.site.com domain to http://xxx.site.com/ preserving the URL path (e.g. http://xxx.yyy.site.com/kitten?say=meow will be …
LazyOne's user avatar
  • 4,929
1 vote
Accepted

htaccess Rewrite Syntax?

This does work fine here: # Some options that _may_ be required for rewrite to work # (depends on hosting/server configuration) Options +FollowSymLinks +SymLinksIfOwnerMatch -MultiViews # Activate R …
LazyOne's user avatar
  • 4,929
5 votes
Accepted

clean urls and differences in hosts

You need to add the following line into your .htaccess file(s): Options +MultiViews The effect of MultiViews is as follows: if the server receives a request for /some/dir/foo, if /some/dir …
LazyOne's user avatar
  • 4,929
1 vote
Accepted

.htaccess 301 rewrite rule not working

1. Try adding [L] flag next to R=301 -- right now redirect will not occur straight away and URL gets processed by other rules (the WordPress block). The L flag in conjunction with R=3xx tells Apache t …
LazyOne's user avatar
  • 4,929
2 votes

URL Rewrite to subdomains?

1) On your website, make sure that you generate PROPER URLs, e.g. http://minecraft.domain.com/1/lorem-ipsum instead of /article.php?id=1&category=Minecraft&Name=Lorem+Ipsum Here, the acceptable chara …
LazyOne's user avatar
  • 4,929
1 vote
Accepted

Issue with permanent redirect implementation

To force www. to be present in a domain name try this one instead (it's safer to have domain name hard coded): RewriteCond %{HTTP_HOST} !=www.example.com RewriteRule (.*) http://www.example.com/$1 [Q …
LazyOne's user avatar
  • 4,929
3 votes

htaccess and 301 redirects - multiple domains

You seems to have quite a few domains and subdomains pointing to the same folder (so they share the same .htaccess) which makes your original approach not suitable for such situation. Use these rules …
LazyOne's user avatar
  • 4,929
5 votes
Accepted

Having trouble redirecting old product sites and categories to new pages

The common mistake that a lot of people do is trying to match whole URL including query string. The reality is: when matching URL, the pattern get applied to path part of it and query string has to be …
LazyOne's user avatar
  • 4,929
11 votes
Accepted

How to redirect / convert any URL to lowercase?

To implement such redirect using mod_rewrite and .htaccess you need to use RewriteMap directive which cannot be placed in .htaccess -- only in server config / VirtualHost context. If you have such acc …
LazyOne's user avatar
  • 4,929