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 ...

learn more… | top users | synonyms

1
vote
1answer
411 views

mod_rewrite to change parts of a URL causes infinite loop error.

I moved my website to a new CMS and some of my URLs look different now, so I want to delete a part of incoming URLs so that links to my page still work properly. The old URL looks like: ...
0
votes
1answer
585 views

Verify 2 cookies with mod_rewrite before serving images

I have the following mod_rewrite rule, which works fine in my Apache 2.x on CentOS 6 Linux machine, but is not complete: RewriteCond %{HTTP_COOKIE} !id RewriteCond %{REQUEST_URI} ...
0
votes
1answer
812 views

Override .htaccess from parent directory

I have a local LAMP stack (without the MySQL. LAP stack? Anyways..) and I am using this as a development environment for a production website. The site is placed in a sub-directory of the Apache2 ...
2
votes
2answers
2k views

Is it possible to force a directory index to display even if an index file exists?

On my Apache server I need to display a directory index of a given folder even if it already contains an index file that has been defined in DirectoryIndex. In this case an index.html file exists, but ...
0
votes
2answers
93 views

How to make mod_rewrite work transparently?

Following is the content of .htaccess file <IfModule mod_rewrite.c> Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ...
0
votes
1answer
588 views

.htaccess 301 rewrite rule not working

I had made the page the-book.html in wordpress site, later changed the name to about-the-book, now i have written the .htaccess file as **RewriteRule ^the-book.html$ ...
1
vote
3answers
2k views

Using env variables with RewriteRule and ErrorDocument

I'm having problems with the following while config. my Apache server to Rewrite some urls. SetEnv PATH_TO_DIR /directory RewriteRule ^%{PATH_TO_DIR}/([a-zA-Z0-9_\-]+)/([a-zA-Z0-9_\-\.]+)/?$ ...
2
votes
1answer
89 views

What's the “^” in RewriteRule Statements?

I keep seeing the ^ character in RewriteRule statements in a context that doesn't fit with the usage specified here. For example: RewriteRule ^(.*)$ $1.php [L,QSA] What does it signify?
0
votes
1answer
269 views

Redirect all urls to a subfolder

I have several old, broken urls that looked like this: http://www.easyjob.net/partners/whatever.html I would like to redirect them all to http://www.easyjob.net/partners/general/ The following rule ...
0
votes
1answer
414 views

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 ...
0
votes
1answer
195 views

just another mod_rewrite question

from the url xxx.yyy.site.com just need to redirect to xxx.site.com Thanks for the help, sorry I have no regex/rewrite foo.
1
vote
2answers
199 views

Google Analytics when 404 handler is used as 'mod_rewrite'?

I'm consulting on a web site which in order to provide clean URL's uses the 404 handler to catch what would otherwise be a 404 and serve the correct content. In case that's not clear the 404 handler ...
0
votes
1answer
1k views

Mod Rewrite not working

I am trying to get the URL www.mysitedomain.com/blogs/displaynamehere to show what is in the directory at www.mysitedomain.com/blogs/blog.php$display=displaynamehere So thanks to the people who ...
2
votes
3answers
133 views

How to make parameters look more attractive

I'm making a blog site and instead of the users blogs being called /blog?display=username I would like it to just be a sub domain such as mysite.com/username How would I be able to make the first ...
2
votes
1answer
268 views

Optimal way to implement very big redirect list in Apache2

I have about 6000 URLs that need to be redirected after changing the CMS. All those URLs are stored in a DB table together with an ID that allows me to tell what is being referenced. Using this table ...
0
votes
1answer
545 views

Apache mod_rewrite for multiple domains to SSL

I'm running a web service that will allow people to create their own "instances" of my application, running under their own domain. These people will create an A record to forward a subdomain of their ...
1
vote
1answer
852 views

How do I get mod_rewrite working with typo and wordpress?

I've some trouble with typo3 (mydomain.net) and wordpress (mydomain.net/blog/) using mod_rewrite. First I was running a typo3 installation which uses mod_rewirte without trouble. Now I'm trying to ...
3
votes
1answer
462 views

clean urls and differences in hosts

I am developing a relatively static website, where I want to be able to access each page without typing .html (or .htm or .xhtml ...) at the end (/about not /about.html). I am developing using the ...
1
vote
1answer
35 views

Mod Rewrite change extention of a page

i want to mod rewrite change extension of any page to what i want. for ex. i want change index.php to index.abc is it possible with mod rewrite?
5
votes
1answer
891 views

How to internally rewrite a page when requested from specific HTTP_HOST

I have a Drupal site, site.com, and our client has a campaign that they're promoting for which they've bought a new domain name, campaign.com. I'd like it so that a request for campaign.com internally ...
2
votes
1answer
95 views

Issue with permanent redirect implementation

I have a tricky problem related to 301 redirections I badly need help with. I tried to implement these via .htaccess, but ran into trouble. The start of my .htaccess looks like this: SetEnv PHP_VER ...
1
vote
1answer
1k views

URL Rewrite to subdomains?

say i have a website with /article.php?id=1&category=Minecraft&Name=Lorem+Ipsum and /topic.php?category=Minecraft how would i setup url rewrite to make the topic pages being ...
1
vote
2answers
140 views

htaccess rewrite problem

Maybe is best way to show my problem in one example. In my .htaccess : RewriteRule ^catalog/[a-z0-9_-]+-([0-9]+)/[a-z0-9_-]+-([0-9]+)/[a-z0-9_-]+-([0-9]+)/ ...
1
vote
1answer
192 views

Apache Redirect based on directory name

I'm trying to use one install of Kohana to manage two separate sites rather than just duplicate the install. I have directories like this: applications/ app1/ app2/ The .htaccess I have ...
0
votes
1answer
228 views

htaccess 301 Redirect with URI

How can I write a .htaccess mod_rewrite rule to redirect all traffic to a specific subfolder to a different subdomain, but include all the trailing URI and url structure and in a SEO friendly way. ...
1
vote
2answers
83 views

Is there something wrong with my .htaccess or is there something wrong server-side?

I'm using the following .htaccess file in one of my subdirectories on my server: Options +FollowSymlinks RewriteEngine on RewriteRule (.*)\.png generate.php?userid=$1 My non-production environment ...
1
vote
1answer
916 views

Mod_rewrite on Amazon S3

Is it possible to use mod_rewrite on Amazon S3? www.example.com/about.html -> mybucket.s3.amazon.com/index.html www.example.com/welcome.html -> mybucket.s3.amazon.com/index.html ...
1
vote
1answer
241 views

Kohana with cherokee

How to setup kohana's index.php with cherokee webserver? Should i add a rule to redirect all to index.php? These settings don't work Rule RegExp ^.*index.php.*$ Redirect ^(.*)$ => index.php$1
1
vote
1answer
252 views

301 Redirect are these URLs equivalent?

I want to redirect an entire duplicate directory to the same files in the directory above the dup_folder. Redirect Code in .htaccess: Redirect 301 /dup_folder/ http://www.example.biz/ It redirects ...
4
votes
1answer
2k views

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 => ...
0
votes
1answer
170 views

mod rewrite help needed to redirect old domain to new domain

I recently switched sites from janeullah.com (which had an A dns entry pointing to janeullah.zenfolio.com) to janeullahphotography.com. I'm on Dreamhost, currently have A record on janeullah.com going ...
0
votes
1answer
299 views

Changing mod_rewrite “file exists” checks to not see directories as files

I have the following mod_rewrite rules set up: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php This works fine, allowing me to ...
0
votes
1answer
219 views

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 <IfModule mod_rewrite.c> RewriteEngine On ...
3
votes
1answer
131 views

Can I get IIS to treat some .shtml files as .php files?

I want to be able to get IIS to interpret SHTML files (only in a specific directory) as PHP, and interpret the rest as SHTML. If so, then how?
1
vote
1answer
1k views

mod_rewrite causing too many redirects

The .htaccess we have in our document_root directory is as follows: RewriteEngine on RewriteRule ^posts/1/first-post-title$ /posts/1.html [L] RewriteCond %{REQUEST_URI} ^/posts/1 RewriteCond ...
2
votes
2answers
63 views

I want to redirect anyHOST.anyTLD to www.anyHOST.anyTLD

I'm trying to find a generic enough modrewrite rule that will acomplish following: Redirect anyHost.anyTld to www.anyHost.anyTld Not mess with any other subdomains, for examle other.anyHost.anyTLD ...
1
vote
1answer
2k views

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 ...
0
votes
2answers
161 views

Is it possible to mod_rewrite BASED on the existence of a file/directory and uniqueID?

My site currently forces all non www. pages to use www. Ultimately, I am able to handle all unique subdomains and parse correctly but I am trying to achieve the following: (ideally with ...
0
votes
1answer
266 views

How to block access to a sub-site with mod_rewrite?

Let's say I have the sites siteA.com and siteB.com. They are hosted such that siteB.com actually points to siteA.com/siteB. How can I block someone from visiting siteA.com/siteB using mod_rewrite? ...
1
vote
2answers
99 views

rewrite on urls to add “/”

I know how to rewrite urls to redirect to a page. When the "/" is not at the end of www.DomainName.com/user/myUserName the redirect works: RewriteRule /$ /user/index.php When I write RewriteBase / ...
1
vote
1answer
419 views

Regex Needed to allow mod-rewrite rule to work either with or without trailing slash?

Given the following rewrite rule: RewriteRule ^user/([^/]*)$ /userprofile.php?user=$1 [L] How can I have it work either with or without a trailing slash? Bonus points, how can I verify ([^/]*) ...
3
votes
2answers
5k views

Rewrite for robots.txt and favicon.ico

I have setup some rules in which subdomains (my users) will default to where I have located the robots.txt, favicon.ico, and crossdomain.xml therefore if a user creates a site say ...
0
votes
2answers
85 views

RewriteRules targeting a directory result in a gratuitous redirect

I have a standard CMS-like RewriteRule set up in my .htaccess: RewriteRule ^(.+)$ index.php?slug=$1 Let's say I have a directory called "foo" in the root directory. For some reason, if you hit the ...
2
votes
2answers
666 views

Redirecting a CSS file based on .htaccess rules

I'm trying to hack the css files on OSTicket by replacing them with my own custom ones when a specific URL is accessed. The URL that is accessed for this example is ...
2
votes
2answers
113 views

Virtual hosting

I want to use domains like xxx.abc.domain.tld. The xxx is my folder to access. I tried it with the rewrite rules, but I can't get it working, because I don't know how to get the part xxx from the ...
-1
votes
4answers
154 views

Hosting plans that allow more then 1 GB for mysql and easier mod_rewrites? [duplicate]

Possible Duplicate: How to find web hosting that meets my requirements? I'm using godaddy and am thinking of moving to another hosting company that allows easier mod_rewrites and a bigger ...
1
vote
1answer
60 views

Simple mod_rewrite Question

I want to have everything that looks like this: /1/2/3/4/5/[...] to redirect to this: /index.php?u=/1/2/3/4/5/[...] unless the requested string is a specific file. So anything that doesn't have a ...
0
votes
1answer
391 views

Force www. on multi domain site and retain http or https

I am using CakePHP which already contains an .htaccess file that looks like: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) ...
4
votes
1answer
8k views

Properly force SSL with .htaccess, no double authentication

I'm trying to force SSL with .htaccess on a shared host. This means there I only have access to .htaccess and not the vhosts config. I know you can put a rule in the VirtualHost config file to force ...
1
vote
1answer
1k views

Using mod_rewrite to send all requests to a certain document

I want to temporarily redirect all requests for a site to index.html, using apache only. Is this mod_rewrite approach going to work, and is it the right way to do it? RewriteEngine on RewriteRule ...