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
234 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
307 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
14k 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
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, ...
1
vote
2answers
619 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 ...
4
votes
1answer
3k views

How to write a generic .htaccess file rule, regarding RewriteBase

The following rule in my .htaccess works just fine for routing calls to index.php: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php [QSA,L] However, this does not ...
2
votes
1answer
354 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 ...
2
votes
0answers
485 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 ...
1
vote
1answer
92 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 ...
0
votes
0answers
226 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 ...
2
votes
2answers
3k views

Mod Rewrite - directing HTTP/HTTPS traffic to the appropriate virtual hosts

I have an Apache2 web server (v. 2.2.16) running on Debian hosting three virtual hosts. The first two hosts are HTTP only (server1 and server2). The last host is HTTPS only (server3). My virtual host ...
2
votes
1answer
1k views

Joomla 1.6 URL rewrite on IIS7 (removing /index.php/)

Joomla 1.6 was released today and I'm wondering if anyone knows how to get rid of the /index.php/ part? How link looks now: http://www.example.org/index.php/stuff How link would look after URL ...
1
vote
3answers
267 views

Including title page name in PHP URLs

How do I show titles of the page in URLs? Currently: http://websitename.com/index.php?c_id=18&start=0&m_id=1 Change To: ...
0
votes
1answer
684 views

.htaccess: Redirect Hotlink Flash --> Site with embed Flash

I have some PHP sites that embeds SWF files. These SWF files are now linked to by some other guys. And I don't want them to simply open the SWF, I want them to force being redirect to the page where ...
3
votes
1answer
389 views

subdomains apache rewrite rules

Let's say I have my web folder as public_html. In there I have a sub folder. I can view the folder at: www.mydomain.com/sub & mydomain.com/sub What I want is: sub.mydomain.com This will show ...
6
votes
5answers
7k views

How to Remove Extensions From, and Force the Trailing Slash at the End of URLs?

Example of current file structure: example.com/foo.php example.com/bar.html example.com/directory/ example.com/directory/foo.php example.com/directory/bar.html ...
0
votes
1answer
400 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
146 views

Apache mod_rewrite problem

I try to use Apache mod_rewrite to redirect some pages on my customer's website to the homepage. The .htaccess file is the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / ...
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
2answers
49 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.
2
votes
2answers
393 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 ...
-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 ...
7
votes
1answer
270 views

Apache rewrite rules for development workstation and server

I've got developers editing pages for several sites on a WAMP stack and then uploading to the public servers running LAMP stacks. We're pretty happy with it, but we have this minor annoyance: we can't ...
1
vote
1answer
1k views

mod_rewrite with Apache -> mod_jk -> tomcat

Related to some of my earlier questions. I now have a setup I quite like; Apache httpd listening on port 80 accepting http and https connections. Several Tomcat instances running on several AJP ...
1
vote
2answers
898 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 .* ...
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.
4
votes
5answers
840 views

Site compromised .htaccess files everywhere

Some of the sites we're hosting are compromised by... I don't know what. Every directory on the webserver contains a .htaccess file which redirects a user coming from a search engine to a page which ...
0
votes
2answers
61 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
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 ...
2
votes
2answers
380 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
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
6k 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 ...
1
vote
2answers
283 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 ^/?$ ...
1
vote
1answer
203 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 ...
0
votes
1answer
224 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
198 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 ...
3
votes
1answer
216 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 ...
3
votes
1answer
678 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 ...
3
votes
1answer
588 views

RewriteRule working local but not on remote server

I have a .htaccess file with one simple RewriteRule: RewriteEngine on RewriteRule ^([A-Za-z0-9-]+)$ ?site=$1 I want to have an url like http://www.example.com/imprint and forward it to ...
5
votes
2answers
806 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
680 views

Rewrite img and link paths with htaccess and serve the file from rewritten path?

I have a static mockup page, which I want to "customize" by switching a variable used in image-src and link-href attributes. Paths will look like this: <img src="/some/where/VARIABLE/img/1.jpg" ...
1
vote
3answers
763 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 ...
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 ...
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 ...
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
300 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 ...