mod-rewrite

RewriteRule for static files in subfolder

拜拜、爱过 提交于 2019-12-24 06:44:40
问题 I have following folder structure for my website: index.php .htaccess public_html/css/* (css files) public_html/images/* (image files) public_html/js/* (javascript files) All the static files in the subfolder public_html are linked in my page files without public_html: e.g. /images/logo/logo.png I setup following .htaccess file, which is working fine on my local apache and on my webspace, but on the customers webspace, it is not working: RewriteEngine On RewriteBase / RewriteCond %{DOCUMENT

Mod Rewrite is giving me a hard time

╄→гoц情女王★ 提交于 2019-12-24 06:44:30
问题 I'm currently using wamp on windows 7. I'd like to clean my urls obviously. I've tried to find the current syntax and what not, but I haven't figured it out. My path right now is localhost/rs/index.php When I go to localhost/rs/user it gives me a 404, but localhost/rs/ gives me the index.php page. This is what I have in my .htaccess file at the www directory of wamp. RewriteEngine On RewriteRule ^/$ index.php RewriteRule ^/([a-z]+)$ index.php?page=$1 RewriteRule ^/([a-z]+)/$ index.php?page=$1

htaccess URL Rewrite with and without query string

那年仲夏 提交于 2019-12-24 06:43:14
问题 I'm trying to rewrite some urls but my newbness is getting in the way. URLs input into the address bar example.com/prefix-suffix.html example.com/prefix-suffix.html?v=huzzah Desired output (would like them displayed like) example.com/prefix/suffix/ example.com/prefix/suffix/huzzah I've looked at a few other examples like this one, but I just don't understand what they are doing exactly or how rather, which makes it challenging to modify. If you have the time to explain what each line is doing

.htaccess rewrite wildcard subsubdomain and params

本小妞迷上赌 提交于 2019-12-24 06:42:05
问题 I'm trying to write a mod_rewrite to work like this wildcard.subdomain.domain.com => subdomain.domain.com/data.php?q=wildcard wildcard.subdomain.domain.com/?repeat=1 => subdomain.domain.com/data.php?q=wildcard&repeat=1 subdomain.domain.com => data.php www.subdomain.domain.com => data.php What I've done so far in my .htaccess <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On RewriteCond %{HTTP_HOST} ^([^.]+)\.abc\.def\.com\.br$ [NC] RewriteCond %1 !^(www)$ [NC] RewriteRule ^.*$

Apache proxy / rewrite setup for specific file types inside sub directory

拈花ヽ惹草 提交于 2019-12-24 06:34:56
问题 Recently I had to migrate somesite which was nearly 15 years old, consider the new url is https://mynew.domain.com and the old site was https://myold.domain.com (Internal IP : 192.168.1.15, which is not available in public domain) In old site it was having directory called "sitefiles", in which many sub folders and files like images, files etc So what I want to achieve is suppose if user hits url on browser which was file request with white listed extensions such (.jpg , .jpeg, .png, .pdf,

.htaccess remove all .php and id as default parameter after slash

对着背影说爱祢 提交于 2019-12-24 06:08:11
问题 I have the following .htaccess file which helps me to rewrite the http://domain/path/project.php?id=1 as http://domain/path/project/1 . RewriteBase / RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-s RewriteRule ^(.*)$ project.php?id=$1 [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.*)$ project.php [QSA,NC,L] RewriteCond %{REQUEST_FILENAME} -s RewriteRule ^(.*)$ project.php [QSA,NC,L] But I need all the php's in the current directory to be

How do I use mod_rewrite to both redirect and rewrite a directory?

痞子三分冷 提交于 2019-12-24 05:53:30
问题 Don't flag this as a duplicate unless you know what you are doing. Some questions look similar, but aren't what I'm looking for. If a user hits example.com/friendly-folder it should be internally redirected to example.com/system-folder . However if a user hits the old example.com/system-folder it should be externally redirected to the new name example.com/friendly-folder . So, basically, the directory URL must always be friendly, but pointing to the old one. I believe if I just made two rules

How to write htaccess for subdomain redirection to https

梦想与她 提交于 2019-12-24 05:48:25
问题 How to write htaccess rules for redirect example.com to www.example.com and also we have number of subdomains for example subdomain.example.cpm so i need to redirect it to https://subdomain.example.com. but when i write htaccess rules it is going to loop. please send how to write conditions for this. 回答1: Put this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On # example.com to www.example.com RewriteCond %{HTTP_HOST} ^example\.com$ [NC] RewriteRule ^ http://www.%{HTTP_HOST}%

rewrite uppercase url to lowercase url htaccess

*爱你&永不变心* 提交于 2019-12-24 05:41:45
问题 I want my urls that contain uppercase characters to be redirected to lowercase url's. Unfortunatly i don't have access to the httpd.config file. So i tried this method to rewrite the urls with the htaccess file: http://www.askapache.com/htaccess/rewrite-uppercase-lowercase.html . But it adds extra / because it's a loop and also it doesn't work (504 error) when the url consists of more than two parts (ex www.mysite.com/part1/part2/part3/ ) How can i fix this or is there an other/better method?

.htaccess RewriteRule for directory

余生颓废 提交于 2019-12-24 05:34:14
问题 I would like to use the RewriteRule for the following www.mysite.com/xyz or www.mysite.com/xyz/ ==> should go to www.mysite.com/page.php?var=xyz www.mysite.com/xyz.html www.mysite.com/xyz.htm www.mysite.com/xyz.php or any other extension ==> should not be rewritten Only when there's no file extension, the rewrite rule should be used Thanks! 回答1: Put this code in your DOCUMENT_ROOT/.htaccess file: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f