CakePHP + admin routes + .htaccess + production mode

The following site shows a (kinda hack-ish) way to protect an admin route with .htaccess: If I understand it correctly, it only works because CakePHP runs a check for the 'real' file presence before it processes its own URL logic. So, when you request, it checks for the default document in the (real, since we've created it) /admin dir, and this check triggers the authentication. My issue is: the 'hack' works OK if I s

.htaccess CodeIgniter: Multiple Apps, remove .php from url

My question may look similar to others, but it's different as you'll se: I have 5 CI apps running with the same System Folder, as described in CI User Guide. Now, I want some .htacces file to remove just the .php from the url, like, as example: instead of (removing the .php portion of the url) Can I do that? I have no experience with .htaccess files. Also, I'm developing the site in Windows 7 with XAM

.htaccess Redirect to specific pages depending upon the url routing using htaccess file

I have the urls like http://localhost/mis http://localhost/mis/newsletter.php http://localhost/mis/cms.php?mainid=65 http://localhost/mis/news.php?mainid=93 Well I am using these urls for school section. Now for the A-level section I have the following urls http://localhost/mis/index.php?mode=0 http://localhost/mis/newsletter.php?mode=0 http://localhost/mis/cms.php?mainid=65&mode=0 http://localhost/mis/news.php?mainid=93&mode=0 I want the above urls to be routed like

.htaccess url construction htaccess

Lets say I have a link to one of my page that looks like:, I need it to look like: How do I achieve this? Can I achieve this by modifying my htaccess file? which currently looks like this... RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^([^/]+)/$ $1.php RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI}

.htaccess URL Rewriting - htaccess web.config

I have imported in IIS these rewrite rules : RewriteRule ^search/(.+)/([0-9]+)?$ search.html?name=$1&page=$2 [QSA,L] RewriteRule ^search/(.+)?$ search.html?name=$1&page=1 [QSA,L] Translation is : match url="^search/(.+)/([0-9]+)?$" ignoreCase="false" action type="Rewrite" url="search.html?name={R:1}&page={R:2}" appendQueryString="true" match url="^search/(.+)?$" ignoreCase="false" action type="Rewrite" url="search.html?name={R:1}&page=1" appendQueryString="true" bu

.htaccess Excluding single directory under protected Wordpress site from htpasswd protection

Despite a good deal of searching here I haven't been able to find the solution to this problem. I have an .htaccess file that is protecting a Wordpress site that I am developing. I would like to protect the entire site except for the directory /images/, but I can't work out how to do this. At the moment my .htaccess file, in the root of the site, looks like this: # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUE

.htaccess htaccess rewrite server error

Hi guys experimenting with .htaccess with XAMPP on my localhost, I have checked with phpinfo() if mod_rewrite is loaded and it is, so that shouldnt be the problem.. This is my .htaccess RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-l RewriteRule ^(.+)$ index.php?url=$1 [QSA, L] and this is the error it gives on every page SERVER ERROR The server encountered an internal error and was unable to complete your reque

.htaccess httacces Rewrite URLs

I wanted to rewrite some urls from to and with pagination looks like to to with pagination like the first one to and so on.. for the last example i tryed RewriteRule ^sandale-barbati/pagina-([0-9]+)/ /sandale-barbati.php?page=$1 [L] Rewr

.htaccess not working in LAMP

i used CI, i downloaded project from server it has a .htaccess file. when i run these project in my localhost is not working, i have to put index.php after project path , like there is read/write rule in .htaccess file. for run .htacces i use these much but still not working. In /etc/apache2/sites-available/default modify the line containing AllowOverride None to read AllowOverride All. and then restart apache. for check read/write rule enable or not i ru

.htaccess Percentage (%) in the joomla blog post url breaking site

Anyone know how to redirect domain/blog/208-%-top.html To: domain/blog/208-top.html in Joomla? None of the below works: RewriteRule ^blog/208-%-top.html$ 208-top.html [R=301,L] RewriteRule ^blog/208-\%-top.html$ 208-top.html [R=301,L] RewriteRule ^blog/208-.*-top.html$ 208-top.html [R=301,L] It works if: url has %20 or %25 and have below in htaccess RewriteRule ^blog/208-%20-top.html$ 208-top.html [R=301,L] RewriteRule ^blog/208-%25-top.html$ 208-top.html [R=301,L] But the p

.htaccess vBulletin To bbPress Conversion - How Can I Redirect The Old URLs To The New Ones?

I converted my vbulletin forum to bbpress and everything works fine except the redirection of the old urls part. I want to redirect old vbulletin urls to the new bbpress ones using .htaccess but i have no idea how to do it. I’m still new to URL redirection. Old vBulletin URL: New bbPress URL: Can anyone help me? I would really appreciate it. UPDATED: Here are the contents of my .htaccess fil

.htaccess doesn't allow me to execute root files except index.php

I've this code in my .htaccess file on my domain Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f [NC] RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index\.php?main_page=$1&%{QUERY_STRING} [L] RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] But I can't execute other than index.php file on same domain like It redirects me to Kindly help me out to sol

.htaccess Need redirect old url to new friendly url

a need redirect to I try to add a line in htacces redirect 301 /product.php?id_product=216 but dont work. If I add Redirect /product.php All links like Go to h

.htaccess Symfony: htaccess to hide app.php or app_dev.php

I know this has been asked many times, but something strange is happening to me. Apache DocumentRoot is pointing to symfony/web/ and this is my .htaccess inside web/ dir: DirectoryIndex app_dev.php #DirectoryIndex app.php <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{ENV:REDIRECT_STATUS} ^$ RewriteRule ^app\.php(/(.*)|$) %{CONTEXT_PREFIX}/$2 [R=301,L] RewriteCond %{REQUEST_FILENAME} -f RewriteRule .? - [L] RewriteCond %{REQUEST_FILENAME} -f Rewri

.htaccess Using Mod_rewrite for short URL's

I'm trying to make my url's short using mod rewrite. Somebody told me it can be achieved using htaccess? Although I'm a novice at php/mysql I will attempt to solve my own problems via google and my limited knowledge. However I know nothing about htaccess, so I'm seeking somebodies help. I have user profiles located at where 169 is the users id. How do I change it to something like ? The script I use already uses mod_rewrite to create

.htaccess remove index.php and index.php query string from url

I'm having the following issue: I have this url and I want to rewrite it to also, I want to get rid of index.php when the url is called without any params eg: or should redirect to My htaccess file looks like this: Options +FollowSymLinks RewriteEngine on RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(index\.php)?\?([^&\ ]+) RewriteRule ^ /%2? [L,R=302] RewriteRule ^index.php

.htaccess Remove All $_GET Variables from URL - htaccess

I'm having an issue in trying to get my search URL to be "SEO Friendly", at the moment my URL currently looks like this - If the user wants to search for multiple features the URL looks like . If the user selects one feature I would like my URL to be written like the following -

.htaccess how to display a coming soon page when a page doesn't have an index page using htaccess

my directory looks like this: / /comingsoon.php /.htaccess / < folder / < folder i can access on or simply i want to display comingsoon.php when i get an 403 error. i tried this: ErrorDocument 403 /comingsoon.php but it only works on but not in and i don't want to put comingsoon.php inside, i just want it in the root, coz i have a lot of accounts

IP banning via .htaccess not working

Liteserver on a Shared access host here. I'm trying to get rid of a lot of bots who waste my resources for nothing. I can successfully restrict access to some of them using a specific User Agent, but I can't ban their IP addresses, together with those of a lot of chinese ones who are constantly scanning my website. I am still seeing AhrefsBot IP ( in the access log, even if its IP is banned (see the last line of the htaccess file). The rules should already be inherited by /gallery s

.htaccess htaccess not working as required

I cannot get my .htaccess file working properly. Please can someone help me correct it. I used to try and get it correct, but with no success. should show in the address bar as and show the rolex-watch.php page should show in the address bar as

.htaccess htaccess - Point domain and a sub domain to a folder

I have two folders on FTP root. site_v1 and site_v2. site_v2 has new version of website and site_v1 has older version. I wanted to point my domain to site_v2, the latest version. So I made an .htaccess on root as under. RewriteCond %{HTTP_HOST} RewriteCond %{REQUEST_URI} !site_v2/ RewriteRule ^(.*)$ site_v2/$1 [L] This works well. When I open; site_v2 loads seamlessly. Then, for site_v1, I created a sub domain and pointed it to site_v1

.htaccess CodeIgniter Remove index.php in URL

I've created a codeigniter project in Ubuntu system and added following base_url as follows. If I access any other url like as follows. That redirects to 'Page Not Found'. If I include index.php after base_url, Its working fine. And I created .htaccess file as follows. RewriteEngine On RewriteBase /project RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L]

.htaccess How to redirect a url containing specific strings and Percentage (%) character

Here are my example urls: http://ww

.htaccess htaccess mod-rewrite ~ how to modify url from /pages/pagename.cfm to /pagename/

I have to do a website structure cleanup on a site... looking for the htaccess directive to rewrite all pages url to a friendlier url structure without moving the actual pages in folder hierarchy. so every page that is within the /pages/pagename.cfm would rewrite its address to /pagename/ and respond to both /pagename/ and /pages/pagename.cfm urls. lets keep in mind I need the pagename to be dynamic, not hardcoded in the htaccess directive. Thanks a lot! my

.htaccess Website self-referral

Google Analytics is showing my own root domain is the referral for a large portion of my website's traffic. So, is showing as the referrer for I have tried adding a referral exclusion within Analytics with no success. I have cleaned my .htaccess which also hasn't been successful .htaccess code RewriteEngine On Options +FollowSymLinks # Redirects mywebsite/uk/anypage to RewriteRule ^uk/(.*)$ /$1 [NC,R=302,NE,L] # Redirect 404 to index Er

.htaccess CodeIgniter and base_url(), form submission issue

my earlier issue was solved which spoke about base_url duplication in CodeIgniter. However, after editing base_url() as base_url = "", form submission does not load my thank you page. I have checked it with Firebug, there is a Response: 200 OK coming. But my view register-done.php does not load no matter what I do. The form just stays there. Doesn't move, though the data goes to database and registered. Before this fix, it was working fine. here is the html of form-submi

.htaccess to access the file but to ignore non existing directory in URL path for that file

I have my htaccess and it already does couple of good things (it hides www and .php in my url) but I also need to add one additional feature to it. I have the main domain called: I have a root folder called: Most important files are kept in the root. I have also the following file in the root: about.php I love to access about.php file by calling non existing directory: And my full URL path looks like this: I would like to access the f

.htaccess How to re-direct blog article URLs?

I am trying to redirect a bunch of old blog article URLs using the .htaccess file: RedirectMatch ^/index\.php/global/article/(.*)$$1 This doesn't really work, however, because my CMS seems to get confused by the index.php bit and keeps adding ?symphony-page= to all the URLs. It's probably this part that is responsible: ### FRONTEND REWRITE - Will ignore files and folders RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteR

.htaccess RewriteRule with 2 values

url : http://siteexample.tld/index.php?a=profile&u=johndoe I am trying to change this url to look like siteexample.tld/profile/johndoe if if a=groups then siteexample.tld/groups/nameofgroup etc... this is my htaccess so far RewriteEngine on RewriteCond %{request_filename} -f RewriteRule ^(.*) $1 [L] RewriteRule ^(([^/]*)+)(/([^/]{0,32})(/.+)?)?$ index.php?a=$1&q=$3 [L]

.htaccess Prouct price depending upon User IP

I want to have 2 prices for a product. If user is from India, it should take price-1 and if the user is from out of India, it should take price-2. I just know it will be done through IP basis. But i am not getting how to do it. Please can somebody suggest me with the rough idea so that i can implement it. Thank you

.htaccess Nginx reverse proxy disable listing directories - autoindex

I have a reverse nginx proxy location / { autoindex off; proxy_set_header HOST $host; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://owncloud/; } Now I want to prevent that users can go to https://url.tld/data and view the folder content... autoindex off; is not working. I want to achieve this without changing the (ownc

.htaccess Redirect all html pages except home page to php version

I'm currently using: RewriteEngine On RedirectMatch 301 (.*)\.html$ $1.php This works ok, but the problem is that redirects to How do I inhibit the home page php redirect from happening while keeping all other pages redirected? For example: >> >> >> (i.e., nothing happpens)

.htaccess Why deosn't this rewriterule work?

The company I currently work for has a 3+ years live site based on symfony 2.8. Recently it was deployed for testing to a new customer. The images on the original are accessed in the html like "/bundles/bundlename/images/image.png". On the customers server however the whole thing is under a subfolder, so image url's should be like "/d2s/bundles/bundlename/images/image.png". We have a .htaccess file in the project's web dir like this: DirectoryIndex app.php <IfModule mod_rewrite.c> Re

.htaccess mod rewrite based on just one parameter

Evening, I'm trying to do a rule to convert this: into this: Right now I have this: RewriteRule ^pt/herbario/cons_reg_ncom2.asp(.*)$ /pesquisa/ncomum/$1 [L, QSA] But according to this redirects to a URL like this:

Grant access to only one directory with .htaccess

I want to only provide public access to a single directory (/dist). I have an .htaccess file with the following: Order deny,allow Deny from all <Directory /dist> Order Allow,Deny Allow from all </Directory> I'm trying to first deny access to all, then overwirte that directive with a allow rule for the /dist directory. However, when I try to access any file through the browser, I get the following: Internal Server Error The server encountered an internal error or misconf

.htaccess Transfert an url with parameters into a pretty URL with htaccess

I want to use URL rewrite with my .htaccess to redirect my non pretty URL: to this one: So I used: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)$ url.php?module=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)$ url.php?module=$1&action=$2 [L] RewriteCond %{REQ

.htaccess 301 redirection is not working in html website

I used this below code to redirect my website ( but it is not working please help me to redirect it! my website developer is confused! Please rewrite and help me...i dont know what is the error ??? RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^ [NC] RewriteRule ^(.*)$$1 [L,R=301] RewriteEngine on RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.pages\ HTTP/ RewriteRule ^index\.pages$ http://www.earabictoe

.htaccess Simple htaccess base rewrite for site in subfolder, links with relative paths

I want to put up a site for demo purposes in a subfolder on my server, where all links are using relative paths (i.e. starting with "/"). This defaults back to the root folder, the easiest way to solve this would probably be to set up a htaccess file. I just cant seem to get it right. Am I missing something here? I've tested and made sure mod_rewrite is enabled inside the folder. Options +FollowSymLinks RewriteEngine On RewriteBase /mydemo/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQU

.htaccess Rewriting GET parameters

I'm trying to rewrite $_GET parameters via .htaccess. I have tried doing it myself but no success. Check what I want below: to My /var/www/ directory: I have tried using this rule but my server keeps saying 500 Internal Server Error RewriteRule ^system/(.*) /system.php?id=$1 [NC,L] Here is my .htaccess file at this current time RewriteEngine On RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}

.htaccess htaccess - how to only allow access to subfolders within its redirect/directoryindex?

Bit of a confusing one. My website structure in GoDaddy is as follows: /public_html /folder1/ /index.html /folder2/ /index.html /restrictedfolder /secretfolder I've created a .htaccess file inside the 'public_html' root which contains the following: DirectoryIndex /folder1/index.html If I go to, it directs me to the folder1 and shows my home page correctly. My URL (to the user) remains as which is what I want. The problems I have are: -

How to use .htaccess to redirect while maintaining the original URL

I am trying to use the .htacces file to redirect any files or subfolders in a derectory to one file, while still maintaining the original URL input. So if a user goes to: or it would redirect them back to: but the original URL input would not change.

.htaccess rewrite subdomain with wild card for any subdomain

I have many multiple subdomains and would like an example how my .htaccess would look like using a wild card so I can rewrite any http://* to either goto the root or goto a folder. This is what I have tried but it does not seem to work. I have activated Rewrites in apache2. Options +Includes +ExecCGI +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^subdomain\.example\.com$ [NC] RewriteRule ^((?!subdomain/).*)$ $1 [L,NC] AddType application/x-httpd-cgi .cgi .p

.htaccess Redirect to https and www not working using htaccess

I am unable to achieve 301 redirect to https and www. The domain is and due to redirect error, there is duplicate pages issue from SEO perspective. Following is my current code set inside htaccess file. The server used is Litespeed. I am using Cloudflare and hence added X-Forwarded Protocol too incase its due to cloudflare conflict. I also tried disabling cloudflare but still same issue. The site can be accessed with or without www which is not desired. RewriteCo

  1    2   3   4   5   6  ... 下一页 最后一页 共 104 页