.htaccess

My htaccess RewriteRule works on localhost/mysite but not at mysite.com on a 1&1 shared host

旧巷老猫 提交于 2019-12-31 00:47:07
问题 Solved: unfortunately, the solution is not a satisfying one. This morning, when trying @Wige's Suggestion, I found, to my suprise, that the Expected values WERE infact sent to the page as a GET query. Apparently, 1&1 (who I know have been making changes to their environment this last couple weeks), did something behind the scenes which magically fixed my problem, and now all of my previously unworking code is working as originally expected. New info : The Apache version of the production

Rewriteengine in .htaccess to catch files not ending in html

↘锁芯ラ 提交于 2019-12-30 22:29:27
问题 I'd like to use mod rewrite in to convert web page addresses like /directory to /directory/index.html , in a standard LAMP hosting situation. What I have works for addresses that end in a slash. I can't find a way to handle addresses that don't end a slash . What seems like it should work is: rewriterule ^(.*)/$ $1/index.html [L] /* addresses ending in / */ rewriterule ^(.*(?!html))$ $1/index.html [L] /* where the problem is */ But the second line causes a 500 server error. If I add a single

Leverage browser caching

纵饮孤独 提交于 2019-12-30 18:59:07
问题 I have a website and when I check page speed with Google plug-in, I receive: Leverage browser caching The following resources are missing a cache expiration Where can I change the settings for this? 回答1: Edit .htaccess and append <IfModule mod_expires.c> ExpiresActive On ExpiresByType image/jpg "access 1 year" ExpiresByType image/jpeg "access 1 year" ExpiresByType image/gif "access 1 year" ExpiresByType image/png "access 1 year" ExpiresByType text/css "access 1 month" ExpiresByType

htaccess url rewrite with multiple variables in url

…衆ロ難τιáo~ 提交于 2019-12-30 14:09:19
问题 I want to make some url rewrite rules on my .htaccess file so that this link: http://myseite.com/index.php?var1=value1&var2=value2 will become : http://myseite.com/var1/value2.html So far I have managed successfully to solve this problem but only for one variable. I also tried this code: RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?var1=$1&var2=$2 [L] But it doesn't work.. Thank you for the help! 回答1: Request for http://mysite.com/var1/value2.html is rewritten to http://mysite.com/index.php

htaccess url rewrite with multiple variables in url

99封情书 提交于 2019-12-30 14:08:50
问题 I want to make some url rewrite rules on my .htaccess file so that this link: http://myseite.com/index.php?var1=value1&var2=value2 will become : http://myseite.com/var1/value2.html So far I have managed successfully to solve this problem but only for one variable. I also tried this code: RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?var1=$1&var2=$2 [L] But it doesn't work.. Thank you for the help! 回答1: Request for http://mysite.com/var1/value2.html is rewritten to http://mysite.com/index.php

Htaccess maintenance mode allow certain directories

你。 提交于 2019-12-30 12:15:29
问题 So I use the following for to force my site into maintenance mode while updating certain things: # MAINTENANCE-PAGE REDIRECT <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REMOTE_ADDR} !^23\.1\.12\.167 RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC] RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC] RewriteRule .* /maintenance.html [R=302,L] </IfModule> This has worked well, but now I have the situation when in maintenance mode that I wish to exclude certain dir's from being

Trying to hide .htaccess file

杀马特。学长 韩版系。学妹 提交于 2019-12-30 12:14:26
问题 I'm trying to hide my .htaccess file so everyone can't just read it out in their browser. My .htaccess file is located here: http://businessgame.be/.htaccess as you can see you can still just read it out. I tried adding the following: # secure htaccess file <Files .htaccess> order allow,deny deny from all </Files> and also <FilesMatch "^\.ht"> Order allow,deny Deny from all </FilesMatch> But none of it seems to work. This is really weird. Am I doing anything wrong? 回答1: You just follow this

Redirect non-www and non-https to https://www

泪湿孤枕 提交于 2019-12-30 12:13:47
问题 I want to redirect non-www and non-https URLs to https://www for my domain, I actually have the following htaccess, that works ok redirecting non-https to https but still allows to access domain.com without www, RewriteEngine On RewriteCond %{HTTPS} !=on RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI}%{QUERY_STRING} [L,R] # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f

Simple Page Redirect?

半城伤御伤魂 提交于 2019-12-30 11:47:06
问题 I have a page at http://site.com/services/ and I just want to redirect it to http://site.com/servics/first-service/ Whats the best redirect to do this and how do I do this? 回答1: PHP : header("Location: yourpage.php"); exit; You have to use exit or die after header in order to stop execution of your code. Also, the code has to be executed before any output. HTML : <meta http-equiv="refresh" content="0;url=yourpage.php"> The code should be placed between <head></head> tags. JavaScript : window

Apache Mod Rewrite for Pretty URLs isn't working

谁说我不能喝 提交于 2019-12-30 11:21:23
问题 I'm trying to figure out how to do an apache mod_rewrite to remap $_GET . What I'm trying to accomplish: Currently, to get to the page one would have to go to http://www.domain.com/index.php?URL=pages/the-page.php I would like this to work in 2 ways: If someone goes to domain.com/the-page , it takes them to the above but keeps it looking like this. Secondly, if someone goes to the http://www.domain.com/index.php?URL=pages/the-page.php , it will still show as domain.com/the-page , keeping the