I want to password protect an entire directory and authenticate users though a MySQL database using PHP. I know you can password protect directories using .htaccess but I can't seem to find out how to use PHP and MySQL along with that.
...
As you know the dash introduces a comment
how can I make this valid?
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^(.+)\.php$ /#$1 [R=301,NC]
...
Hey
I want to, using htaccess, allow hotlinking BUT if someone views an image on my site I want to redirect them to a "hosted" version of the image where I display my navigation etc.
So essentially anyone hotlinking from an external site will not be affected but if someone views the image on my server directly i.e. www.domain.com/image...
I have two websites that is actually the same where example.com shares all files from examples.com. So whatever changes made in exampples.com, example.com automatically gets updated. That means they have the same .htaccess file.
The problem is, I want to both sites redirects to non www to a www url. I got this:
RewriteEngine on
RewriteC...
hi guy its my first time here and my english sukcs, sorry...
i have a problem with my .htaccess, i'm trying to redirect a page with a safe url using this code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^noticias/pagina/([0-9]+)/?$ news.php?id=$1 [NC,L]
but my swf files called...
I'm interested to create subdomains on the fly directly from php. For example when an user create a new page I want that page to be newpage.mydomain.com. Is that possible without changing the php or apache configuration files (supposing I'm using a shared hosting account).
Later Edit: I'm talking about my domain, and I have full access ...
Hi,
I know there is lots of topics regarding my question. I checked them all and tried them out but can't make it work.
I need to rewrite http to https on some pages only. After visiting https pages the URL would go back to http.
This is what I have so far:
# Rewrite Rules for domain.com
RewriteEngine On
RewriteBase /
#Rewrite www ...
The following code inside an .htaccess file is behaving incorrectly..
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_HOST} ^(domain\.com)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/(.*)$ /test/$1 [L,QSA]
The above will correctly send requests to 'domain.com/uri-here' to the '/test/'...
My website is a mercurial repository with multiple subrepositories. I need to make sure I'm denying access to all files in every .hg directory on the server.
For example, I have http://example.com/.hg/ and http://example.com/subrepo1/.hg/
I've added the following to .htaccess:
<Files ~ "^\.(hg|ht)">
Order allow,deny
Deny from ...
I have to put a site down for about half an hour while we put a second server in place. Using .htaccess, how can I redirect ANY request to domain.com to domain.com/holding_page.php?
...
My client keeps editing the structure of the navigation in the website, which is leading to some mod_rewrite issues. How could i make this rule:
RewriteRule ^studios/about-studios/artist-noticeboard noticeboard2.php?section=studios&subSection=studio-artists [L]
to work if the url contains "noticeboard"? Like this:
RewriteRule ^IF CON...
Hi,
I couldn't find a straight answer to my question and need to know it from the real experts.
I had a website which urls were generated by Joomla. I believe that tons of urls are around in the search engines and I really don't know which of them all. A 302 redirect would be an option, but I can't say which urls need to be redirected....
Hi there,
I was wondering if it's possible to use 404 error and 301 redirect in the same .htaccess like this:
I have found the most urls which are important that people will be redirected. For the 404 error, these are for the "left overs"
Can it be used like this, if there is no rule for a 301, a 404 error applies or will the 301 redi...
I have three domains of the same name with tlds: .com, .de and .ru.
Can I route the visitor depended on tld he had choosen?
As example: test.com routes to /english/ directory,
test.de to /german/ directory,
test.ru to /russian/ one.
I have full access to the server.
...
Have the following mod_rewrite rule:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
RewriteRule ^index\.php$ / [R=301,L]
</IfModule>
Which strips .php from any of my urls.
However, if I try to specify a 301 redirect to...
Original Question:
what could be the mod_rewrite, to rewrite urls with this structure: http://hiwis.net/jobs/Computer/ to something with this structure: http://hiwis.net/Computer/
--
I need some help with the mod_rewrite for my hiwis(dot)net site to rewrite urls with this structure: hiwis(dot)net/jobs/Computer/ to something with t...
i want to protect some folders from a normal user but i (from localhost or my IP address) m unable to see the folder structure...so i do this
write a .htaccess file in that folder(eg.project/cms/js) and write below code
# no nasty crackers in here!
order deny,allow
deny from all
allow from 192.168.1.7
but by using this prohibit to ev...
I have two websites:
http://example.com
http://example.com/sub
I have a page, let's say:
http://example.com/sub/page1
Is there any way (using .htacces) to make it possible to access page1 via this url:
http://example.com/page1?
Redirect 301 won't do the work, because I don't need redirects. Is there any way to omit '/sub/' for cert...
We have a dev server that has managed to become indexed by Google. Page 2 of a relevant search on Google will throw up links to the dev server instead of the live one (with the same content.)
However, we have now locked the dev server down behind IP address restrictions and htpasswd authentication, so any inbound traffic from google wil...
I have the following htaccess rule I'd like to apply for every IP address apart from mine. I basically want to show a "site is down" page for everyone apart from myself. How is this best achieved?
RewriteEngine on
RewriteCond %{REQUEST_URI} !/indexTEMP.php$
RewriteRule $ /indexTEMP.php [R=307,L]
...