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
124 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 ...
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 ...
3
votes
3answers
513 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
1answer
371 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
259 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
1answer
67 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, ...
2
votes
1answer
358 views

How do I map a (keyword rich) domain name to an existing website?

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

How to allow a Subdirectory to work and stop redirecting?

I run Drupal on a webserver in the root www directory. I have added another application in a www subdirectory (Piwik). When I try to navigate to the subdirectory app, I get this error message "The ...
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 ...
1
vote
0answers
98 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$ ...
2
votes
0answers
509 views

RewriteBase has to change when using UserDir

I have setup our Apache server to use UserDir This mean our urls are: http://dev.server.com/~username/drupal/html/ Before our URLS were: http://dev.server.com/drupal/html/ In the 2nd case I ...
0
votes
2answers
62 views

mod_rewrite issue, won't work when links contain “-”

I've been looking into mod_rewrite for my simple PHP CMS for a couple of days now and I found a rule that was supposed to work for me: RewriteRule ^(\w+)/?$ view_post.php?url=$1 This is supposed to ...
1
vote
1answer
73 views

Empty Cookie based on IP address

Is there a way to empty a previous cookie based on source ip? I need this to be done because of loadbalancing issues. regards Geert
1
vote
3answers
3k views

“File does not exist” in Apache error log when mod_rewrite is using

I am getting below error in server log, when re-writing the URLs. [Fri Jan 25 11:32:57 2013] [error] [client ***IP***] File does not exist: ...
1
vote
1answer
95 views

Redirect www to non-www only for https://

I can't seem to find a nice way to redirect https://www.x.co.uk to https://x.co.uk whilst letting http://x.co.uk and http://www.x.co.uk keep whatever they want. Could anyone lend a hand? I have ...
2
votes
1answer
203 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
2answers
188 views

How to setup up .htaccess rewrites for http and https on the same site?

I'm having some issues with htaccess rewrites i need to redirect different parts of my site to HTTPS rather than HTTP, for example login and news sections. I'm not sure how to go about doing this in ...
2
votes
1answer
4k views

how to rewrite %20 in .htaccess

I need to perform an equivalent rewrite to: RewriteRule ^/this%20file.pdf http://www.example.com/ How do I handle the %20? I have tried RewriteRule ^/this\%20file.pdf http://www.example.com/ ...
2
votes
1answer
226 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 ...
2
votes
1answer
158 views

how to fix .htaccess - redirect http://408.111.1111.domain.us/ to http://domain.us/index.php?w=408.111.1111

We want to use mod_rewrite and .htaccess to do a redirect. How do we redirect http://408.111.1111.domain.us/ and www.408.111.1111.domain.us/ to http://domain.us/index.php?w=408.111.1111 ? If the ...
7
votes
1answer
1k views

.htaccess redirect url without trailing slashes

In my htaccess I have some rewrited urls like these: RewriteRule ^first-page$ /subdir/page.php?id_page=1 [QSA,L] RewriteRule ^second-page$ /subdir/page.php?id_page=2 [QSA,L] RewriteRule ^third-page$ ...
2
votes
2answers
440 views

HTACCESS Wildcard Subdomain forward to Domain

I know this may seem like a duplicate, but I am unable to find a solution. Is it possible to setup wildcard subdomains with htaccess? I have an example of http://test.domain.ca I need to forward ...
2
votes
3answers
2k views

mod_rewrite works within directory not on root

I am having a problem with my RewriteRule for the querystring portion. What I am able to debug is that the rule is being triggered at least because the page "tags.php" is being rendered but without ...
1
vote
2answers
274 views

WordPress .htaccess preventing subfolder access

This is sort of a goofy setup, but it's not in my power to reconfigure it at this time. I'm running in a shared hosting environment. The domain is example.com. This is an add-on domain on the host ...
1
vote
0answers
132 views

Apache, Rewrite Rule and Directories

I'm using the current virtual host: <VirtualHost *:80> ServerAdmin webmaster@mysite ServerName example.co.uk ServerAlias www.example.co.uk DocumentRoot ...
2
votes
1answer
7k views

Enable 'mod_rewrite' Using .htaccess File On cPanel Shared Hosting Server

I'm using cPanel to host my website. I need to enable 'mod_rewrite' on this Shared Hosting cPanel account to run my script. I've tried to Google the solutions high and low but did not find any luck ...
4
votes
1answer
232 views

Redirect non-www to www while preserving protocol

I am aware of the fact that there are tons of questions in this section and in server fault dealing with re-directions from non-www to www URLs. But I couldn't find one dealing with this issue while ...
1
vote
1answer
204 views

Removing 301 redirect from site root

I'm having a look at a friends website (a fairly old PHP based one) which they've been advised needs re-structuring. The key points being: URLs should be lower case and more "friendly". The root ...
2
votes
1answer
114 views

Rewrite catalog/index.php to www.domain.co.uk [closed]

We have an online shop with a welcome page. Our SEO company has asked us to get rid of the welcome page with a rewrite. I am struggling to get this to work. Can you help please? I want to rewrite ...
1
vote
1answer
419 views

Using mod_speling with multi-level htaccess and rewriterules

We recently switched formats for managing our 301s. For the most part, everything went well, but it seems to have stopped mod_speling from working properly. Here's what we changed: old ...
2
votes
1answer
478 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...
0
votes
1answer
245 views

mod_rewrite and SEO friendliness

My website has an atypical structure and I'm not sure if this could create problems in the long run, specially for SEO positioning purposes. I have a unique, large PHP script, and I use the Apache ...
3
votes
1answer
219 views

How can I redirect all files in a directory that doesn't conform to a certain filename structure?

I have a website where a previous developer had updated several webpages. The issue is that the developer had made each new webpage with new filenames, and deleted the old filenames. I've worked with ...
1
vote
2answers
313 views

How do I redirect www and non but not IP

I am trying to redirect www.domain.com or domain.com to www.domain.com/temp.html I am using the following code: RewriteCond %{HTTP_HOST} ^.*$ RewriteRule ^/?$ ...
3
votes
1answer
200 views

Mod rewrite - redirecting url with certain parameter to new url

I need some help redirecting a url with particular parameter value to a new url. For example how can i redirect these two urls with id 123 and 345 to a new url? Redirect ...
2
votes
1answer
378 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 ...
5
votes
2answers
835 views

.htaccess two different rules but only one per time

I'm rather new to the whole .htaccess thing and I'm using the following right now to use 'pretty url's': <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d ...
3
votes
1answer
704 views

Wild card redirect in htaccess giving error this webpage has a redirect loop

In my website I changed the directory name "vehicles-cars" to "vehicles-cars-for-sale". When I tried to redirect using a wild card redirect from my old directory name to new directory name in my web ...
1
vote
1answer
94 views

Mod Rewrite - url rewriting

I am very new to mod rewrite. I need to redirect any user with "citzenhawk" parameter in their url to my url for example ...
3
votes
1answer
526 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 ...
0
votes
1answer
74 views

rewrite url for articles with htaccess

I've had a look through several other questions to see if i could get this working but have had no success at all at the moment so i'm hoping someone can help. This is the url i currently have, ...
0
votes
1answer
314 views

How to silently auto-load from a subdirectory, but allow internal paths to think the file is located at site root?

I have files in my site root, and also files in its "Iternet_IE" directory. I need to: 1.) be able to call/include other files (e.g. headers or footers) from within files at either of those ...
2
votes
1answer
4k views

mod_rewrite to edit cookies conditionally

Is it possible to use mod_rewrite to modify values in cookies based upon a condition? I am completely new to HTTP, but I have tried a thing or two. The only regex I know is Perl-style, I hope it is ...
0
votes
1answer
622 views

Using mod_rewrite to rewrite URLs with question marks in them

This is probably a mind-numbingly simple question, but for some reason mod_rewrite always manages to completely befuddle me every time I interact with it. A long time ago when I set up my blog and ...
0
votes
1answer
154 views

htaccess Rewrite Syntax?

I have a bunch of files with a "NEW-" prefix (e.g. "NEW-index.php"). I need to do a 301 redirect to the corresponding file without the prefix. I've tried a few things but I'm not getting the regex ...
1
vote
2answers
1k views

How to redirect a website from a folder to the root folder?

I was running a website on a folder (www.example.com/folder). The new version of the website is live and runs on the root folder. How should I redirect users who visit the website using the old URLs ...
0
votes
1answer
1k views

Link to pages on site without .html extension appearing in browser?

I've modified my .htaccess file to allow access to html files without having to include the extension on the end, for example: www.mysite.com/document directs to www.mysite.com/document.html ...
2
votes
2answers
387 views

Help with URL Rewrite

I have a page that selects some info from a database and displays it with a link to a second page that uses the result to query the database, something like this: $sel=mysql_query("select id, title ...
2
votes
2answers
786 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 ...