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

0
votes
1answer
140 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/ ...
3
votes
1answer
142 views

Standard Wordpress mod_rewrite rules interacting with one of my own rules are causing all requests for a certain page to be sent to the homepage

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22. NOTE: I can't share the domain that I'm working on, and must santize any config files and log outputs. While the ...
2
votes
1answer
667 views

Redirecting one page to HTTPS, and all others back to HTTP isn't working as expected

I have WordPress 3.5.1 installed on Ubuntu 12.04 LTS. I'm running Apache 2.2.22. NOTE: I can't share the domain that I'm working on, and must santize any config files. While the website is public, ...
1
vote
2answers
112 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
55 views

mod_rewrite change . to -

I'm moving my site and the URL structure has changed because of the new CMS. The urls would be similar to /my.products.htm on the new site we are changing the URLs to this /my-products is their a way ...
1
vote
2answers
276 views

.htaccess remove index.php/url/ from URL

.htaccess is not working. /index.php/user -- is working http://www.example.com/user is not working Current .htaccess file: RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond ...
3
votes
1answer
228 views

Remove dynamic generated end of URL

I have a Joomla 2.5 website with joomshopping and AceSEF extension component. SEF URL generation works just fine except one issue. For some reason, there are dynamic parts generated in the end of ...
0
votes
2answers
255 views

Pretending a file is in subdirectory with .htaccess

I have a web application, and it has a RESTful PHP backend that uses Zend framework (which does its own URL rewriting magic). The problem is, my backend's entry-page is api.php and the endpoints look ...
3
votes
2answers
432 views

RewriteRule not working for certain URLs

There are a few domains pointing towards the same server, and of course I need them all redirect to only one of them. Redirects work, but only for certain URLs. What works: http://www.domain.com, ...
0
votes
2answers
662 views

SEO on multilanguage website URL

I'm setting up a multilanguage website and I would like to have your help to take the best decision as regard SEO. After reading this. I would like to change my URLs from this form ...
1
vote
2answers
1k views

How do I redirect a URL using rewrite in .htaccess that has a question mark and forward slash where page.html is the variable?

Hello and thanks to all who contribute to this seemingly mind boggling puzzle. I apologize in advance if .htaccess questions belong on server fault. So I have to move a domain to our hosting servers, ...
1
vote
1answer
218 views

Google Analytics shows visits to pages redirected in .htaccess

Yesterday, I switched on a section of pages in our site that replaces a really old collection of pages. In our .htaccess file, I have rules that redirect a request for any page in the old section to ...
3
votes
1answer
120 views

URL not found after rewrite

Using this .htaccess file: Options +FollowSymLinks Options +Indexes RewriteEngine On RewriteRule matches/(.*)-v-(.*) matches/matchevent.php?event=$1%20v%20$2 [R=301,L] This url: ...
2
votes
1answer
197 views

mod rewrite doesn't work when i added multiple domains

i have redhat linux server and i was using /var/www/html to display my site. By using the following directive rewrite mod was working fine. <IfModule mod_rewrite.c> # Enable mod_rewrite ...
1
vote
1answer
188 views

Silent redirection not working with mod_rewrite

I'm trying to grasp apache mod_rewrite When I add this to my .htaccess it silently (url doesnt change) shows page bob.htm RewriteEngine on RewriteRule index.htm bob.htm I.e. If I type this in the ...
1
vote
1answer
577 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 ^(.*)$ ...
2
votes
1answer
64 views

Simple RewriteRule [duplicate]

I'm trying to write a RewriteRule to make a simple url. I want users to be able to type enter www.example.com/somepage and have it take them to www.example.com/abc/somepage.php How can this be ...
1
vote
0answers
58 views

optimize htaccess

I have two condition which are conflict RewriteRule ^patients/findadoctor/(.*)\.html$ subcategorydoctor.php?id=$1 [L,NC] and RewriteRule ^patients/findadoctor/(.*)\.html$ ...
2
votes
1answer
215 views

Internal CDN and setting up subdomain to increase maximum parallel connections

I've heard that browsers can have around maximum of 6 parallel connections per domain at a time. So I decided to have another subdomain "cdn." then use mod_rewrite to point to media folder then ...
1
vote
1answer
56 views

Redirecting previous domain subfolder links

I've recently bought a domain that was unregistered. After looking in Google webmaster tools, Google is trying to crawl random pages that don't exist. Turns out it did have a previous owner. The ...
1
vote
0answers
158 views

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

Rewritten URLs stopped getting indexed a month ago

I'm working on a website for someone which sells their products on their web site. There is an item.php page which displays the item for sale. I switched all item pages/inks from dynamic URLs to ...
1
vote
2answers
1k views

Have UserDir enabled but also want to rewrite url if called differently

I am setting up a new server for our users to use have have personal webspace on. I have in my httpd.conf of apache the directives for UserDir as follows UserDir disabled root UserDir public_html ...
2
votes
1answer
87 views

.htaccess redirect with mod_rewrite

I moved my wiki from http://jklatex.square7.de/wiki/doku.php/start to http://logicpuzzle.square7.de/start and now i want to redirect the URL with mod_rewrite. My .htaccess is as follows: # BEGIN ...
3
votes
4answers
2k views

How to create .htaccess to block access to a subdirectory that hosts a separate domain

So I am pretty noob at with creating code in .htaccess, but I know it is what I need to accomplish a pretty simple task. So here is what I want to do. I have a main domain, (me.com), and I am hosting ...
0
votes
2answers
169 views

Help with Apache mod_rewrite rules

I want to change some legacy URL's like this: /modules.php?name=News&file=article&sid=600 to this: /news/story/600/ This is what I have tried: RewriteEngine on RewriteCond ...
2
votes
1answer
418 views

Apache rewrite rule that matches a specific query string

I need to rewrite a specific wordpress url to a 404 error: ?page_id=15 => 404 How can I match the query string? Apparently Apache doesn't feed that to the rewrite mod...
1
vote
1answer
129 views

How do I get rid of the “www” with mod_rewrite?

I want to get rid of the "www" in front of my domain, and I'm trying the following, but it's not working: RewriteEngine On RewriteCond %{HTTP_POST} ^www\.example\.com [NC] RewriteRule ^/(.*) ...
0
votes
2answers
223 views

Issue with Apache redirection [duplicate]

I want to redirect mysite.com or http://mysite.com or www.mysite.com or any other format given my user to http://www.mysite.com, I'm able to achieve this by rewriting following lines in my .htaccess ...
2
votes
2answers
47 views

Need to remove www for only one sub directory from a domain

I have a domain like www.example.com. I need to remove www. from specified sub folder by using a .htaccess file. Example : www.example.com/blog should redirect to example.com All other sub ...
0
votes
1answer
113 views

Capitals in URL subdirectory not changed by htaccess

Within my WordPress website I am redirecting sub directories to internal and external links. Now, when you place a CAPITAL letter in the sub dir it does not work anymore and the website does not show ...
3
votes
3answers
475 views

SEO Joomla URL to WordPress URL's

I am trying to migrate from Joomla 1.5 SEF URL's to WordPress SEF URL's. The old links use this formatting: /site/sectionname/categoryname/id-titlename.html I want to migrate it to ...
1
vote
0answers
95 views

Apache Rewrite to folder no longer working after server upgrade [closed]

The following were both working perfectly for the last 2 years but after a server upgrade the first, with an extra folder is no longer working: RewriteCond %{HTTP_HOST} ^www\.mayoaccommodation\.com$ ...
1
vote
3answers
162 views

How to remove a file from url using mod_rewrite

I want http://www.foo.com/ to internally point to /var/www/home.php and http://www.foo.com/home.php to be redirected to http://www.foo.com/. Thus, I would like to fix the old ...
1
vote
1answer
319 views

Don't $_GET value on link rewrite with .htaccess

I config enable htaccess on my server (i enable mod_rewrite and do like this: http://stackoverflow.com/questions/11064005/enable-htacess-error-on-ubuntu-12-04-with-apache2) But on localhost is run ...
3
votes
1answer
492 views

Disallow all user agents except one using .htaccess?

I've been struggling to get this .htaccess working. The aim is to disallow all user agents besides my app. The app sends a GET request with a user agent of lets say 'AcmeUpdater'. Whenever I try to ...
2
votes
2answers
732 views

getting 500 intenal error when setting 301 redirect using .htaccess

I am trying to use a 301 redirect to direct users and bots to my new site but when I put the .htaccess live i keep getting a 500 internal error shown. The site is actually a subdomain which i want ...
2
votes
3answers
3k views

.htaccess mod_rewrite 500 internal server error

Whenever I place my .htaccess file in my web directory I receive a 500 internal server error and within the error.log file specifying: [Sat Jan 21 13:46:07 2012] [error] [client xx.xx.xxx.xx] Request ...
1
vote
3answers
667 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} ...
1
vote
1answer
358 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 ...
2
votes
1answer
362 views

Need a generic way to create SEO friendly URL

I have searched a lot and implemented many many Regular Expression in my .htaccess file but can not succeed. How do I find a generic way that make my URL SEO friendly? Currently this is in my ...
2
votes
3answers
292 views

Mod Rewrite question

Is there a way to rewrite http://localhost/embed/player.swf?file=http://www.youtube.com/watch?v=7yKDhm4_-90 to something smaller? or is there a way to change this into ...
0
votes
1answer
228 views

htaccess - “detect” url and redirect

Idea is: if URL = "http:/localhost/site/" else if URL = "http:/localhost/site" redirect to "http:/localhost/site/index.html" Can this be done with .htaccess / Apache mod_rewrite and how?
1
vote
1answer
293 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 ...
5
votes
5answers
13k views

“File does not exist” in apache error log

This is an example of an error in out log file: File does not exist: /var/www/website/female, referer: http://www.website.com/female/dresses/A-Dress-Black "/female" doesn't exist, because we use ...
0
votes
1answer
65 views

Redirection transparent to Google and other SE [duplicate]

I am not experienced technical person, and still learning but will try to explain what I have done so far and what my query is. I have a (hypothetical) domain az-studios.com On that domain I have 3 ...
1
vote
1answer
34 views

Trouble reading htaccess canonicalization

I just took over development of a site and am having trouble figuring out the canonicalization rewrite rules (not my forte). I've pasted the code below. The first bit seems straight-forward enough, ...
1
vote
2answers
609 views

.htaccess rules to rewrite URLs to front end page?

I am adding a new application to my site at example.com/app. I want views at that URL to always open myapp.php. E.g. example.com/app -> example.com/app/myapp.php and example.com/app/ -> ...
8
votes
6answers
1k views

Poor Man's Clean URLs vs. Mod_Rewrite

At the company where I work, we're getting ready to design a new web site, and there's some disagreement about how to do clean URLs. Over the past year we've been making small improvements to our ...
1
vote
3answers
115 views

mod_rewrite: rewriting http://$SOMETHING.app.example.com/ to http://www.example.com/app/$SOMETHING

I'm trying to make http://$SOMETHING.app.example.com/ transparently rewrite to http://www.example.com/app/$SOMETHING. The config below is giving me a 404 and I'm not sure why. ServerName ...