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

3
votes
1answer
182 views

Looking for a step by step guide to URL re-writing with mod_rewrite and other methods

I'm looking for step by step resource about how to rewrite URLs and have a few specific questions. I've read the documentation on mod_rewrite in Apache, but I still find myself a little lost. If ...
4
votes
2answers
2k views

URL rewriting removing question mark and replace it with slash

How can I rewrite my URL from edit.php?id=2 to edit/id/2?
0
votes
2answers
2k views

.htaccess rewrite www to non-www and remove .html

I need rewrite rules to redirect the following: http://www. to http:// /file.html to /file I've tried using a combination of these but each time it results in a redirect loop on one of the ...
1
vote
3answers
725 views

What's wrong with my htaccess ? (500 Error)

I've written a small htaccess file to redirect Internet Explorer users to a specific page Here are the contents : # MS Internet Explorer - Mozilla v4 RewriteEngine On RewriteCond %{HTTP_USER_AGENT} ...
2
votes
0answers
135 views

Rewrite rule not matching second level directory URL [closed]

I have this .htaccess in a po_systems folder of my website # Set up mod_rewrite RewriteEngine on RewriteRule ^build_system/([^/]+)/([^/]+)/?$ ...
1
vote
1answer
418 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: ...
1
vote
2answers
908 views

getting mod_rewrite to work on Mac OS X

I'm trying to get mod rewrite to work on my Mac. This is the content of the .htaccess file: <Files *\.ini> order allow,deny deny from all </Files> RewriteEngine on RewriteRule .* ...
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 / ...
5
votes
2answers
1k views

Redirect/rewrite dynamic URL to sub-domain and create DNS for subdomain

I have created an application in PHP, I would like to re-direct the following URL to corresponding sub-domain. Dynamic URL pattern: http://mydomain.com/mypage.php?user_name=testuser I wish to ...
0
votes
1answer
589 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
845 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
1answer
743 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 ...
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 ...
4
votes
2answers
385 views

Case-specific mod rewrite on WordPress subdomain multisite

I have split a WordPress blog into multiple category-specific blogs using subdomains, as the topics in the original blog were too broad to be lumped together effectively. Posts were exported from the ...
1
vote
3answers
868 views

Transparent PHP script execution using mod_rewrite

I am looking for a solution for this a problem: I need that every HTTP request (method is irrelevant) in Apache http server would be served only after execution of specific PHP script. This is needed ...
2
votes
1answer
447 views

403 error with a 301 redirect in .htaccess

I wrote a rewrite rule for one of my pages. This rule is supposed to be for a specific single URL only hence the "static-ness". RewriteRule ^picks/categorizedPicks/126$ ...
0
votes
1answer
229 views

How can I point a subdomain at another server? [duplicate]

Possible Duplicate: How to point a domain to another subdomain? Is it possible to set up a subdomain to render content of another server? Let's say I wanted google.domain.com to render ...
0
votes
1answer
601 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$ ...
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?
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 ...
0
votes
1answer
424 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
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 ...
3
votes
1answer
13k views

How to redirect any URL to lowercase URL?

I have this .htaccess files: ErrorDocument 404 /index.html <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine On RewriteCond %{HTTP_HOST} ^domain\.com [NC] RewriteRule (.*) ...
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
1answer
322 views

how can I set my site root from: localhost/mysite/ to: localhost/mysite/view/ via htaccess

hi just wondering if this is possible, when you access my default site directory localhost/mysite I want to set the path to render localhost/mysite/view/ all my html pages will be rendered here just ...
-1
votes
2answers
2k views

Having trouble redirecting old product sites and categories to new pages

I recently upgraded a shopsystem to prestashop and imported the previous products (~1200), and I managed to keep the old category_id and product_id. I'm trying to set up those 2 rules to redirect all ...
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} ...
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
1answer
281 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 ...
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 ...
1
vote
1answer
865 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 ...
1
vote
2answers
50 views

rewrite url (redirection)

How to rewrite url: www.domain.com domain.com to www.domain.com/sell.html Were sell.html is already rewritten I need some kind of redirection.
1
vote
1answer
605 views

htaccess and 301 redirects - multiple domains

I have the following which redirects mydomain1.co.uk and mydomain1.com to www.mydomain1.com perfectly. RewriteCond %{HTTP_HOST} !^(.*)\.mydomain1\.com$ [NC] RewriteRule ^(.*)$ ...
3
votes
1answer
471 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
2answers
113 views

URL rewrite to fix broken links into a subdirectory — subdirectory was moved to the root directory

I had an e-commerce website hosted on http://mydomain.com/beta for more than a year, eventually I decided to move the website to root http://mydomain.com I had done quite a lot of link postings to ...
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?
0
votes
1answer
147 views

Switch to https

I'm looking to use an .htaccess file to use mod_rewrite to switch the protocol from http:// to https:// when someone hits my website. For instance, once someone goes to: http://www.mywebsite.com/ ...
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
46 views

Tricky mod_rewrite challenge

I list about 9,000 records on my little site. At the moment I'm showing them with a dynamic page, like http://domain.com/records.php?id=019031 But I'd like to start using meaningful URLs like this ...
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
194 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
234 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. ...
0
votes
1answer
403 views

.htaccess mod_rewrite domain to subdomain

I need to redirect any domain to a sub-domain. I know this has got to be possible but for the life of me i can not figure it out. Any help is appreciated. For example: domain1.com domain2.com ...
2
votes
1answer
1k views

Enable mod_rewrite on OpenSuSE 11.04

I have a problem on OpenSuSE 11.04. I configured apache and enabled mod_rewrite but it doesn't working. on every php file I get 403 forbidden error.
1
vote
1answer
376 views

Apache rewrite returns error 500

I'm trying to figure out what I'm doing wrong with this .htaccess rewrite: Options -Indexes RewriteEngine on RewriteBase /test/site/ RewriteOptions MaxRedirects=10 RewriteCond ...
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 ...
0
votes
1answer
384 views

How to use apache mod-rewrite to remove trailing semi-colon on cookie?

We have the following cookie set by a product: Set-Cookie: SSOCookie=T7ngsCmzC2FEq5p2a7o%3D; path=/; domain=.demo.com; We would like to use Apache to remove the trailing ; which doesn't match the ...
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 ...