.htaccess

preventing direct download of SQLite file using .htaccess

梦想与她 提交于 2020-01-01 14:42:55
问题 I know the basics of .htaccess, but freely admit to being a non-expert when it comes to mod_rewrite. The problem: I have a sqlite db file in the document root (no, I can't move it out of here) called data.sqlite . This file is accessed internally by PHP files, however, I want to protect this file from being 'downloaded' by the user typing the db URL directly into their browser. I have used .htaccess to create pretty URLs in the past, and thought using mod_rewrite would provide a nice solution

PHP , htaccess: apply page title in URL

自作多情 提交于 2020-01-01 14:20:18
问题 I want to apply the page HTML title in the URL for example in here (stackoverflow) the url is something like that: http://stackoverflow.com/questions/10000000/get-the-title-of-a-page-url you can see the "get-the-title-of-a-page-url" part which is the page title what i mean is when the user go to spowpost.php?post=1 the actual url that shows up when the pages load will be spowpost.php?post=1$title=..the_title.. how can i do that? EDIT: i was thinking about htaccess , but i don't know this very

How to redirect a URL by only changing the domain name, while keeping other URL parameters

拟墨画扇 提交于 2020-01-01 12:25:08
问题 I'm now migrating my website to a new host and domain, and I want to know if I can redirect anyone who enters any URL of the old website to the new website, while keeping all of the URL parameters. for example: When somebody types in this url http://www.domainA.com/blog/?p=667 , I want him to be redirected to http://www.domainB.com/blog/?p=667 . Is there any way I can do that by adding some .htaccess configurations? Thanks! 回答1: Try this in your .htaccess file: Options +FollowSymlinks

removing parameters from url

白昼怎懂夜的黑 提交于 2020-01-01 12:01:15
问题 i want to remove a parameter after the true url then redirection to the same url without this parameter example : i want to remove the parameter "r" from http://www.mysite.com/123.html?r=1 and redirection to http://www.mysite.com/123.html using htaccess and 301 redirect thank you 回答1: Try this: RewriteRule ^123.html.? 123.html? [L] Note how the second url ends with a ? , this removes the query string. Source: http://wiki.apache.org/httpd/RewriteQueryString 回答2: Better than using a final ? ,

removing parameters from url

假如想象 提交于 2020-01-01 12:01:14
问题 i want to remove a parameter after the true url then redirection to the same url without this parameter example : i want to remove the parameter "r" from http://www.mysite.com/123.html?r=1 and redirection to http://www.mysite.com/123.html using htaccess and 301 redirect thank you 回答1: Try this: RewriteRule ^123.html.? 123.html? [L] Note how the second url ends with a ? , this removes the query string. Source: http://wiki.apache.org/httpd/RewriteQueryString 回答2: Better than using a final ? ,

Redirect to a php/html file on 404 error with .htaccess

牧云@^-^@ 提交于 2020-01-01 10:48:08
问题 I want to redirect all 404 errors to "404.php" for example. I've tryed using ErrorDocument 404 /404.php in .htaccess, but without luck, perhaps my other rules are not allowing this somehow, I'm not really sure as I couldn't find this info on www. If anyone have idea how to solve this, please shout :P My current .htaccess #### pie thingy #### AddType text/x-component .htc #### Rule for Error Page - 404 #### ErrorDocument 404 /404.html #### url rewriting #### Options +FollowSymlinks

htaccess header for specific domain?

↘锁芯ラ 提交于 2020-01-01 10:13:09
问题 I have three environments: env.com env-uat.com env-pre.com All three pages run the same code. I want env-uat.com and env-pre.com to both get this in the htaccess: Header set X-Robots-Tag "noindex, nofollow" This will effectively completely unindex these pages, including PDF files etc. But I don't want to affect env.com. How can I make the Header X-Robots-Tag only be added for env-uat.com and env-pre.com and NOT env.com? ** UPDATE ** From what I could find so far, it would seem you can only do

Apply .htaccess HeaderName to all lower levels?

最后都变了- 提交于 2020-01-01 09:55:22
问题 I'm using the following .htaccess to spruce up my directory list: Options +Indexes IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HeaderName header.html IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Store icons *.log *,v *,t .??* *~ *# It loads header html which contains: <html><head><title>My Stuff</title> <style type="text/css"> body { background: #eee; margin: 33px; color: #333; } h1 { font: 2.0em Georgia,

Apply .htaccess HeaderName to all lower levels?

时光怂恿深爱的人放手 提交于 2020-01-01 09:55:09
问题 I'm using the following .htaccess to spruce up my directory list: Options +Indexes IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble HeaderName header.html IndexIgnore header.html footer.html favicon.ico .htaccess .ftpquota .DS_Store icons *.log *,v *,t .??* *~ *# It loads header html which contains: <html><head><title>My Stuff</title> <style type="text/css"> body { background: #eee; margin: 33px; color: #333; } h1 { font: 2.0em Georgia,

.htaccess not working on my Ubuntu 14.04 Distribution

走远了吗. 提交于 2020-01-01 07:06:50
问题 I have just configured my LAMP stack on my Ubuntu 14.04 distribution and want to set .htaccess up to serve a website. I followed the tutorial https://www.digitalocean.com/community/tutorials/how-to-use-the-htaccess-file and configured a virtual host for my domain, however I am still unable to use the .htaccess file in my projects root, whenever I try to serve a page I get a 404 error . The .conf file for my domain looks like: <VirtualHost *:80> ServerAdmin alexmk92@live.co.uk ServerName