mod-rewrite

Redirect a content of the directory to another directory in parent folder

你离开我真会死。 提交于 2019-12-25 02:31:59
问题 I want to redirect http://www.example.com/myfolder/dir1 to http://www.example.com/myfolder/dir2 . But I want to use .htaccess in dir1 i.e. http://www.exmaple.com/myfolder/dir1/.htaccess . 回答1: Place this this rule as 1st rule in /myfolder/dir1/.htaccess : RewriteEngine On RewriteBase /myfolder/dir1/ RewriteRule ^(.*)$ /myfolder/dir2/$1 [L,R] 来源: https://stackoverflow.com/questions/22113393/redirect-a-content-of-the-directory-to-another-directory-in-parent-folder

mod_rewrite: match string within URL, which regex to chose?

允我心安 提交于 2019-12-25 02:30:05
问题 I would like to use mod_rewrite to capture a string within brackets in my URL and do a redirect. My URL: something?var_a=A&var_b=(B)&var_c=C my .httaccess file with the regex: RewriteEngine on RewriteRule ^/?.+var_b=\((.*)\)$ somedir/$1 [R] I just would like to capture what's in between the round brackets, so my redirect should look something like this: somedir/B I test my regex at http://htaccess.madewithlove.be/ but I get no match. I don't know what I am missing here, even if I try much

Laravel: Set up Laravel vhost

梦想的初衷 提交于 2019-12-25 02:29:42
问题 Hi so I'm setting up Laravel, but it keeps redirecting to the "Whoops something went wrong page" <VirtualHost *:80> DocumentRoot "C:/xampp/htdocs/myfolder/public" ServerName ron@gmail.com ServerAlias l1.mysite.com <Directory "C:/xampp/htdocs/laravel/laravel/public"> AllowOverride All Order Allow,Deny Allow from all Require all granted </Directory> </VirtualHost> I have the l1.mysite.com in my hosts file as well. And in my httpd.conf file, "LoadModule rewrite_module modules/mod_rewrite.so" is

Zeus Rewrite Rules

一个人想着一个人 提交于 2019-12-25 02:24:42
问题 I have a website that renders the URL: /work.php?cat=identity Normally I would research how to use mod_rewrite but unfortunately my hosting (Namesco) uses Zeus and not Apache, which is strange. How would I use Zeus' rewrite rules to convert to: /work/identity This is a much cleaner, nicer SEO friendly version. On top of this, I still need the $_GET variable to be active because it requests information about the variable cat from the database. I've never rewritten URLs before so I've no idea

Apache Mod_Rewrite

不羁的心 提交于 2019-12-25 02:22:23
问题 I'm struggling writing a .htaccess file to basically map the following domains: dev.domain.com/$1 => index.php/dev/$1 api.domain.com/$1 => index.php/api/$1 domain.com/$1 => index.php/front/$1 www.domain.com/$1 => index.php/front/$1 At the moment, everything is mapping to index.php/$1 with the following configuration: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> This is what

mod_rewrite misbehaves if regex matches existing file, but only in .htaccess file

元气小坏坏 提交于 2019-12-25 02:21:03
问题 I've got an .htaccess rule like this: RewriteRule ^z/([^/]+)$ y.html?$1 [NC,L] This rule works fine. But if I change the rule slightly, to: RewriteRule ^y/([^/]+)$ y.html?$1 [NC,L] When I try to load y/anything I get a 404 and the following message in the error log: File does not exist: /var/www/y.html/anything The only difference I can see is that z.html does not exist, but y.html does. At first I thought maybe the initial transform was triggering a recursive re-write, but I don't see how

Rewriting an URL with .htaccess

笑着哭i 提交于 2019-12-25 02:16:50
问题 After facing many problems with the htaccess rewrite rule as it is at the moment I have decided to change it to something more basic but I cannot get the end page to pick up the ID. My .htaccess is: RewriteEngine On RewriteCond %{THE_REQUEST} ^(GET|POST)\ /article\.php\?issue=(.*)&edition=(.*)&id=(.*)&title=(.*)\ HTTP RewriteRule ^ /article/%2/%3/%4/%5\? [R=302,L] RewriteRule ^article/(.*)/(.*)/(.*)/(.*)$ /article.php?issue=$1&edition=$2&id=$3&title=$4 [L] How do I get the article page to

Set alternate content until a specific date with Apache RewriteRule and RewriteCond [closed]

不想你离开。 提交于 2019-12-25 02:06:23
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I need to serve an under construction page until a specific date, but I will be out of the country on the day the new content needs to display, and for a week and a half after (I know, first world problems...) What I currently have serving the under_construction page in my httpd-vhosts.conf file. RewriteRule ^(.

How to redirect main all feed to feedburner except some feeds?

Deadly 提交于 2019-12-25 01:49:04
问题 I want to redirect main feed of my blog to feedburner but I don't want to redirect other feeds like: mywordpressblog.ir/feed/?post_type=post or mywordpressblog.ir/feed/?post_type=daily I have configured the apache .htaccess in this way, but it doesn't work! Any one could help me? <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{HTTP_USER_AGENT} !FeedBurner [NC] RewriteCond %{HTTP_USER_AGENT} !FeedValidator [NC] RewriteCond %{REQUEST_URI} !^/feed/\?post.*$ [NC] RewriteRule ^(.*)$ http:/

.htaccess to re-write incoming requests by inserting “/?load=” after domain name

我们两清 提交于 2019-12-25 01:46:43
问题 I am in need of some help with coding to rewrite incoming links, this is what I need: incoming request http://mysite.com/whatever rewrite to request http://mysite.com/?load=/whatever so in a nutshell the incoming links need correcting by adding "/?load=" immediately after the domain name. The changes are required after making changes to my sites navigation Any help much appreciated :) 回答1: Try adding these rules to the htaccess file in your document root: RewriteEngine On RewriteCond %