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 ...
0
votes
1answer
342 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
589 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
228 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
72 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
292 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
134 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 ...
3
votes
1answer
965 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 => ...
1
vote
1answer
215 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
0
votes
1answer
233 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
185 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
103 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
60 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
228 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 ...
1
vote
1answer
225 views
Infinite redirect loop in cpanel-purchased script
I am installing a script (that I bought on cpanel) in the root directory of my web site.
When I try to install it, it gives me an error. I found that it starts an infinite URL redirect loop containing ...
1
vote
1answer
3k views
How to setup mod_rewrite/htaccess to do url masking and forwarding to a subdirectory?
Its been about three years since I've played with apache and php(I've been using thin and nignx ;). So I've forgotten how to setup a mod_rewrite directive to forward all http requests from root to the ...
0
votes
2answers
632 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 ...
2
votes
1answer
115 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
3answers
91 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 ...
1
vote
1answer
1k 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
1answer
46 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 http://www.example.com/my.products.htm on the new site we are changing the URLs to this ...
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 ...
3
votes
4answers
1k 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 ...
1
vote
1answer
123 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 ^/(.*) ...
2
votes
2answers
882 views
How can I redirect everything but the index as 410?
Our site shut down and we need to give a 410 redirect to the users. We have a small one-page replacement site set up in the same domain and a custom 410 error page. We'd like to have it so that all ...
3
votes
2answers
322 views
How do I redirect an English language URL to an Arabic language URL?
I have a link that's currently formatted like this:
http://site.com/news/view/1.html
I want to it redirect it to:
http://site.com/خبر/عنوان-الخبر
where خبر is equal to news and
عنوان-الخبر is ...
0
votes
1answer
217 views
How to block access to a sub-site with mod_rewrite?
Let's say I have the sites siteA.com and siteB.com. They are hosted such that siteB.com actually points to siteA.com/siteB.
How can I block someone from visiting siteA.com/siteB using mod_rewrite?
...
2
votes
3answers
265 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
...
1
vote
2answers
96 views
rewrite on urls to add “/”
I know how to rewrite urls to redirect to a page.
When the "/" is not at the end of www.DomainName.com/user/myUserName the redirect works:
RewriteRule /$ /user/index.php
When I write RewriteBase / ...
0
votes
2answers
467 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/ -> ...
0
votes
2answers
154 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 ...
1
vote
1answer
214 views
Regex Needed to allow mod-rewrite rule to work either with or without trailing slash?
Given the following rewrite rule:
RewriteRule ^user/([^/]*)$ /userprofile.php?user=$1 [L]
How can I have it work either with or without a trailing slash?
Bonus points, how can I verify ([^/]*) ...
4
votes
1answer
727 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 ...
0
votes
2answers
157 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 ...
0
votes
1answer
576 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 ...
1
vote
3answers
1k 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_\-\.]+)/?$ ...
1
vote
1answer
68 views
wrestling with some rewrites for Apache
I have upgraded my gallery2 to gallery3, and notice that some links no longer resolve correctly. Since the proper way is to redirect these with a 301, that is the way I'm going. The following series ...
1
vote
1answer
541 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
2answers
1k 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 ...
1
vote
3answers
154 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
2answers
2k 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 ...
0
votes
2answers
386 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 ...
3
votes
2answers
4k views
Rewrite for robots.txt and favicon.ico
I have setup some rules in which subdomains (my users) will default to where I have located the robots.txt, favicon.ico, and crossdomain.xml
therefore if a user creates a site say
...
0
votes
2answers
80 views
RewriteRules targeting a directory result in a gratuitous redirect
I have a standard CMS-like RewriteRule set up in my .htaccess:
RewriteRule ^(.+)$ index.php?slug=$1
Let's say I have a directory called "foo" in the root directory. For some reason, if you hit the ...
2
votes
2answers
95 views
Virtual hosting
I want to use domains like xxx.abc.domain.tld.
The xxx is my folder to access. I tried it with the rewrite rules, but I can't get it working, because I don't know how to get the part xxx from the ...
1
vote
2answers
593 views
Need some help on tomcat URL mod_rewrite or mod_jk
I am trying to remove the context name from the URL of my server.
Current URL - http://www.domainname.com/MyApp/
What I need to make is to make it available at - www.domainname.com/
So it is only ...
2
votes
2answers
413 views
Redirecting a CSS file based on .htaccess rules
I'm trying to hack the css files on OSTicket by replacing them with my own custom ones when a specific URL is accessed. The URL that is accessed for this example is ...
2
votes
2answers
2k views
htaccess execution order and priority
Can anyone explain to me in what order apache executes .htaccess files residing in different levels of the same path and how the rewrite rules therein are prioritized?
For example, why doesn't the ...
1
vote
1answer
55 views
Simple mod_rewrite Question
I want to have everything that looks like this:
/1/2/3/4/5/[...]
to redirect to this:
/index.php?u=/1/2/3/4/5/[...]
unless the requested string is a specific file. So anything that doesn't have a ...
0
votes
1answer
354 views
Force www. on multi domain site and retain http or https
I am using CakePHP which already contains an .htaccess file that looks like:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) ...