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

2
votes
1answer
2k views

How do I make SEO friendly URLs from my PHP pages?

I'm pretty new to this and was wondering how to turn my site URLs into SEO friendly URLs using .htaccess and mod_rewrite? My URLs take the form mydomain.com/index.php?pid=1&pagename=Some Page I ...
1
vote
2answers
171 views

Rewrite Issue on index.html

I have index.html on my html_directory on my website also I entered a rule as follows: RewriteRule ^index.html$ newindex.php It seems requests to my site is routing to my index.html file , my ...
2
votes
1answer
758 views

CMS Made Simple: Why does home page return a 404 under www subdomain?

Anyone know why my homepage wont load with the www prefix. Links such as www.mysite.net/about-us will load fine but www.mysite.net returns a 404. Everypage works including the home page if I ...
1
vote
2answers
120 views

Beginner's Apache mod_rewrite - use custom file for website root

Plain and simple - I want user to get main.php file instead of index.php, when he enters website. Such a straightforward task has caused me a lot of pain, and couple of hours googling. Following does ...
1
vote
1answer
1k views

Redirecting not working properly in Firefox 9 (or any older version for that matter)

How do I fix a redirect in Firefox so that it leads my site to another address but with a slash at the end of it? This is my redirect in .htaccess: RewriteCond %{HTTP_HOST} ^test\.mydomain\.com$ ...
0
votes
1answer
405 views

short and friendly URL for affiliate links

This is my first question here on Pro Webmaster... I'm really glad to be here! I believe this question will have a simple answer but I'm starting with htaccess and I want to learn something about ...
2
votes
1answer
85 views

Why is this mod_rewrite redirecting my domain?

I'm trying to redirect all URLs past the "/" of my domain to an old.mysite.com version, but leave the mysite.com itself alone. For example, "mysite.com" -> "mysite.com", but "mysite.com/some-url" -> ...
1
vote
1answer
1k views

Apache rewrite rule for all pages after domain name

I asked this question on stackoverflow.com: http://stackoverflow.com/questions/8466321/apache-rewrite-rule-for-all-pages-after-domain-name Sorry for redirecting, but I wasn't aware of ...
0
votes
1answer
222 views

How to block my images from being displayed by other websites? [duplicate]

Possible Duplicate: How is anti-hotlinking done? I have a lot of images on my site and I don`t want to let other people to use my images on their sites. Is there any way to block the use of ...
1
vote
2answers
2k views

apache domain redirect to subfolder

I have a hosting account with godaddy. Its a linux system running apache. The way they do their setup is your primary domain is the root folder. When you add a subdomain its in a subfolder of the ...
0
votes
2answers
975 views

Apache mod_rewrite rule to convert URL of page, keeping parameters same

I sent out a link in an email that had a typo in the URL. I need to make a quick change for tracking purposes so that any incoming hits to the URL are instead parsed to another URL. From the link ...
3
votes
3answers
222 views

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: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ...
1
vote
1answer
421 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
598 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
877 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
3k 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
604 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
427 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
198 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
201 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
296 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
561 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
880 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
475 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
37 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
896 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
142 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
197 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
236 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
968 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
244 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
171 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
304 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
137 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 ...