.htaccess

condition in .httaccess

hi i am using htpass and htaccess and it is working fine but now i want this: if the user is registered, then htaccess does not play its role - mean to say that no authencation required this time; but when user is not registered then htaccess will play its role(authencation required this). this looks like it should be a simple procedu...

URL rewrite in .htaccess file

Hi all, I have two problems in my current .htaccess. The script below works but has a limitation RewriteRule ^products/([0-9])$ /products/$1/ [R] RewriteRule ^products/([0-9])/$ /viewad.php?adid=$1 Limitation: if adid, is more than 10. it fails. I want it to have whatever number still there and work. my current solution was to add...

fail-safe .htaccess ?

I've recently had to put some code into a different server and my .htaccess file fails miserably. I can stripe out all the parts I don't need but the thing is I'd like to have it on source-control (one file serves many scenarios). Can we have fail-safe rules? I think I'm looking for an if else clause here. # IF THIS IS ALLOWED DO IT # ...

apache .htaccess file on lighttpd

RewriteEngine on RewriteRule ^packed\.js$ pack.php?debug=0 [nc] RewriteRule ^debug$ pack.php?debug=1 [nc] That worked fine on apache in a .htaccess file placed in a specific directory. If I want to do this on lighttpd, do I have to add it in the config file or something? Would I need to make any changes to these rules? ...

How to block search engines from finding sub.domains?

Hi, I want to block search engines like Google and Yahoo from crawling user sub.domains like user.example.com, how can i do it? ...

htaccess not working on ssl on

.htaccess rewrite rule is not working on https RewriteRule ^/templates/Styles/screen.css$ /css/scaffold/index.php?f=screen.css i.e. for http://example.com rewrite it's working fine but https://example.com rewrite it's not working I am using ubuntu and apache2 ...

htaccess and htpasswd?

My first time using htaccess to ask for a user password. on my server .htpasswd file lies in my root directory of my server. .htaccess file lies in folder folder "uploads" (which lies in the root dir) i used … <?php echo dirname(__FILE__); ?> to get the full server path to my root dir. my .htaccess file in my "uploads...

Redirecting static to dynamic URL's

Hi Everyone, I know this has been asked a few times but I can't seem to figure out the correct syntax for our situation. I am trying to permanently redirect links such as example.com/work.aspx to example.com/work in the .htaccess file. Basically converting an ASP.NET site to Wordpress. Any help is much appreciated. Thanks Giles ...

How to rewrite urls like this ?

How would I rewrite ( for every posts in my blog ): http://localhost/post.php?id=13 to http://localhost/this-is-the-title-of-the-post/13 AND ( without id ) http://localhost/post.php?id=13 to http://localhost/this-is-the-title-of-the-post/ ...

PHP - block request from other domain

I have some links like this http://www.domain1.com/files/domain1.com/files/def.jpg http://super.domain1.com/files/super.domain1.com/files/abc.jpg http://www.other1.com/files/other1.com/files/uhj.jpg These websites are hosted in the same hosting and sharing files folder. We separate them by using a sub folder named like domain name o...

htacess mod_rewrite

Hi, I have a page on my site called map-xml.php which is an RSS feed of housing properties. To enable me to submit this to Google's Data Feeds it needs to have an .xml file extension. So how would I go about writing a rewrite rule in htaccess which would make map-xml.xml work? Thanks! ...

.htaccess alongside sessions and cookies

I'm currently working on a website that has a .htaccess authentication user/pass (I'm really not familiar with this type of authentication). I want to know if it's possible to pass the data from that form to a session or a cookie or do I have to pass to a normal login system. Reference links are welcomed :) ...

rewrite from htaccess to codeigniter controller

My codeigniter application directory structure is like --application --htdocs   --index.php   --.htaccess   --folder       --file1.xml Now I have a url http://mysite.com/folder. This is showing the files list in the folder directory. What I want here is to rewrite this url to a controller on my site say 'html.php'....

php - rewrite url with dynamic host name

I need to rewrite url with rule like below RewriteRule ^files/([a-z0-9-\.]+)$ files/domain.com/$1 domain.com is current host name. It is dynamic (don't ask why plz). So I can not do like this. Anyway, how I can get current host name and put it like this: RewriteRule ^files/([a-z0-9-\.]+)$ files/{{ current host name with out www. }}/$...

ModRewrite with HTTPS

I'm using the following mod rewrites to ensure not only canonical URLs but also that the site is displayed using HTTPS: RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} // It think the problem must be here --^ RewriteCond %{HTTP_HOST} ^rto12\.ca$ [NC] RewriteRule ^(.*)$ https://www.rto12.ca/$1 [R=301,L] Rew...

When you auto-create subdomains on user signup does it create a new website or gives appearance of a website?

Hi, I am wondering if subdomains that are created upon signup become websites or do they just give the illusion that they are websites sort of like example.com/username? I am trying to create something like user.domain.com and can't really find something helpful to do it? Is there a way I do it so that i can allow customizations for ...

htaccess with multiple commands?

hey guys, i'm currently trying to do a little upload-feature for some of my clients, so that they can easily upload larger files onto my server. therefore i did a subdomain uploads.mywebsite.com (which links to /uploads) inside of this /uploads i have an .htaccess file which asks for a userpasswd AuthType Basic AuthName "Uploads to mys...

Can I rewrite a URL without redirecting?

So I learned from this handy guide how to use .htaccess to redirect pretty URIs like foobar.com/baz to specific content that may reside at foobar.com/bazheader345.php?user=baz. What if I'd like to do the opposite? My anchors are static but I have a lot of content in different files - and none of them has a particularly pretty name. Say...

Help with dynamic RewriteRule in .htaccess

Hi, I would like to use RewriteRules in .htaccess to achieve particular url rewriting, but can't get it right, can somoene help? I'm trying to rewrite the path (everything between the first and last /) into one query string, and the filename into another e.g: http://domain.com/users/admins/testuser.html rewrites to http://domain.com/...

Removing a folder name from a url using mod rewrite

I have a url structure that looks like this: http://www.blahblah.com/community/i/pagename However, I want to remove the ugly /i/ part. Is this possible with Modrewrite? ...