mod-rewrite

Problems with htaccess redirect

可紊 提交于 2019-12-25 01:44:32
问题 On the following site: http://htaccess.madewithlove.be/ fill the request url with: http://localhost/prefix/games/u_id/game-name Put this in the htaccess area: RewriteEngine On RewriteBase /prefix # stop directory listings Options -Indexes #stops htaccess views <Files .htaccess> order allow,deny deny from all </Files> # redirect game folders RewriteRule ^prefix/games/(.*)$ prefix/protected/files/$1 [L] # remove .php; use THE_REQUEST to prevent infinite loops RewriteCond %{THE_REQUEST} ^GET\ (.

Removing whitespaces or %20 in url using htaccess

∥☆過路亽.° 提交于 2019-12-25 01:33:25
问题 hi guys can you help me here im having a little trouble here im tring to use the htaccess to remove all 20% in my url and replacing it with hyphen I manage to get rid the other 20% in between the words Acer,Liquid,S1,S510 here is my url /localhost/gadgets/product/Acer-Liquid-S1-S510%20Mobile As you can see there is one %20 in last part, how can I remove it And here is my htaccess Options +FollowSymLinks -MultiViews RewriteEngine On RewriteBase /gadgets/ Options -Indexes RewriteRule ^brand/([a

htaccess for subdomain and url rewrite

梦想与她 提交于 2019-12-25 01:28:23
问题 I'm in trouble with this .htaccess RewriteCond %{HTTP_HOST} appname.domain.com RewriteCond %{REQUEST_URI} !appname/ RewriteRule ^(.*)$ /appname/$1 [L] In the document root (not really the root document, let's say a v-domain folder) i have this folder called 'appname'. On appname.domain.com everything shows up fine as it should. Now my problem is when I want to do something like this http://appname.domain.com/somefolder I don't want the url to be rewritten to appname.domain.com/appname

How avoid infinite loop when htaccess rewrites to a copy of same htaccess-file?

瘦欲@ 提交于 2019-12-25 01:25:53
问题 I have this htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} =test.example.com [NC] RewriteRule ^((?!test/).*)$ test/$1 [L,NC] And a completely identical copy of the same file in the "test" directory. So, of course, this leads to an infinite loop when the first file pass you to the second file running the rules again. I have tried add the rule RewriteCond %{REQUEST_URI} !^test [L,NC] in hope that REQUEST_URI stood for the real path and not the new "alias". However, it didn't worked.

.htaccess mod_rewrite remove .php extension, but preserve URL path

跟風遠走 提交于 2019-12-25 01:05:29
问题 I currently have PHP scripts that work properly, being called like this: www.example.com/user.php/paul and www.example.com/tag.php/food I'm having trouble getting .htaccess to rewrite properly. I'm trying to achieve this: www.example.com/user/paul www.example.com/tag/food So far, I can get it to redirect /user to /user.php, but the /paul is lost; breaking my script. My current .htaccess looks like this: RewriteEngine On RewriteCond %{THE_REQUEST} ^GET\ /([^.\ ]+\.)+php(\?[^\ ]*)?\ HTTP

htaccess 301 redirect rule for multiple query strings

二次信任 提交于 2019-12-25 00:39:17
问题 I just want 301 redirect rule for multiple query string to make it SEO friendly url. Internal Url: www.example.com?p=54&p1=ABC XYZ&p2=XXX45767 and so on. 301 Redirect Url: www.example.com/54-ABC-XYZ-XXX45767?p=54&p1=ABC XYZ&p2=XXX45767 So, the redirect url must contain the old query parameters too. 回答1: First step is to check the QUERY_STRING for the parameters in question. If a match is found, then a redirect should occur. You can use the following in your /.htaccess file: RewriteEngine On #

how to ignore the .htaccess file from a parent directory

三世轮回 提交于 2019-12-25 00:38:15
问题 I'm using rewrite rules for search engine optimized url's In my root folder I have the following .htaccess file: Options +FollowSymlinks RewriteEngine On RewriteCond %{http_host} ^elitegameservers.net [NC] RewriteRule ^(.*)$ http://www.elitegameservers.net/$1 [R=301,L] rewriteEngine on rewriteBase / rewriteCond %{HTTP_HOST} ^(.*)haloservers(.nl|.us|.net)$ rewriteRule ^(.*) http://www.haloservers.net/$1 [L,R=301] RewriteEngine On RewriteCond %{HTTP_HOST} ^(www\.)?haloservers(.nl|.us|.net) [NC]

Htaccess ( or + Cakephp)

懵懂的女人 提交于 2019-12-25 00:35:03
问题 I would like to know how can I configure a subdomain to a website. Example www.domain.com subdomain.domain.com How can I configure the htaccess to access the folder subdomain and use it public_html app lib plugins vendors... subdomain app lib... this is my htaccess <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ app/webroot/ [L] RewriteRule (.*) app/webroot/$1 [L] </IfModule> thanks 回答1: in public_html/.htaccess: <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST

RewriteCond RewriteRule for .htaccess based on URL to a new page, regular expression

元气小坏坏 提交于 2019-12-25 00:28:26
问题 I have an interesting RewriteRule and I am not sure to make the regular expression. In short I would like to examine the URL after the second / - based on the contents, possibly forward. It sums down to these two rules: Redirect if string after second / contains any letter Redirect if string after second / is longer than 7 characters Here are examples: http://www.mysite.org/section/subsection/2011 (OK, do nothing) http://www.mysite.org/section/subsection/2011-11 (OK, do nothing) http://www

Redirect One domain to another on the same IP

╄→尐↘猪︶ㄣ 提交于 2019-12-24 23:29:55
问题 I've got two sites, lets call them example.com and example2.com. The website used to only be accessible via example.com but our client wanted to change their name so they registered example2.com. Now example.com and example2.com are now pointing to the same website. I need an htaccess rule that will direct all traffic accessing the site via the old domain example.com and 301 redirect it to the new domain example2.com. I know it's going involve at least one REWRITE_COND but I don't know what