Jump to content

Search the Community

Showing results for tags 'htaccess'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. i have this link Stottoma-BC-textiles/first-bale/-t6/-c2/ and this regex RewriteRule ^.*-([a-z]+)/-t([0-9]+)/-c([0-9]+)/?$ /index.php?Page=$1&baleId=$2&CategoryId=$3 [L] where am going wrong with the regex iam getting not found error
  2. Say below is my normal html href link. How would you turn this into a pretty URL using .htaccess? Also if I understand it correctly, this link will also have to be changed to match the pretty url. What would the new link look like? <a href="shop.php?type=45&name=belts">Belts</a>
  3. This is so strange. I have this bit of code that removes the .php extension from pages so that I can visit any page without typing .php at the end. RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}.php -f RewriteRule ^(.*)$ $1.php [L] The above code has always worked for me before. But for some reason today it stopped working on localhost and the live server(ipage hosting). Do you know why that might be?
  4. Hello, I need help to create htaccess rule for 301 redirect I am trying to redirect a URL with parameters, this one: http://www.domain.com/blog.html?month=7&id=2013 I want to redirect it to: http://www.domain.com/blog/2013.html?view=archive&month=7 But I can't figure out the RewriteCond/RewriteRule Thanks
  5. Hi there, I'm fairly new to sever management and apache. I'm having issues with curl requests on my website and i'm been told to: However even with searching online I can see how to add the exceptions for pages ending in certain file types and not for the exception mentioned above. Here is my HTACCESS FILE: # STARTNITRO RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}] ExpiresActive On #CSS JS XML TXT - 1 WEEK <FilesMatch "\.(xml|txt|css|js)$"> Header set Cache-Control "max-age=604800, public" ExpiresDefault "access plus 1 week" </FilesMatch> #JPG JPEG PNG GIF SWF SVG - 1 MONTH <FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$"> Header set Cache-Control "max-age=2678400, public" ExpiresDefault "access plus 1 month" Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT" </FilesMatch> #OTF WOFF TTF ICO PDF FLV - 1 MONTH <FilesMatch "\.(otf|ico|pdf|flv|woff|ttf)$"> Header set Cache-Control "max-age=2678400, public" ExpiresDefault "access plus 1 month" </FilesMatch> # ENDNITRO # STARTCOMPRESSNITRO RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(\/?((catalog)|(assets)).+)\.css$ assets/style.php?l=4&p=$1&c=604800 [NC,L] RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule ^(\/?((catalog)|(assets)).+)\.js$ assets/script.php?l=4&p=$1&c=604800 [NC,L] AddType image/svg+xml .svg AddOutputFilterByType DEFLATE image/svg+xml # ENDCOMPRESSNITRO RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] # SEO URL Settings RewriteEngine On RewriteBase / RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L] RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css) RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] I would really appreciate if someone could walk me through the code to modified to an the above exceptions. I believe it would be the following code I would need to edit: RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L] But like I mentioned i'm not entirely sure.
  6. Hi guys, I have 2 categories in my website one is CONTRY and the other one is TOWN. Now the non-friendly URL looks something like this: 1. mywebsite.com/country.php?url=clients-in-england (for country category) 2. mywebsite.com/town.php?url=clients-in-london (for town category) Now i want those nonfriendly url's to be something like this: 1. mywebsite.com/country/clients-in-england 2. mywebsite.com/town/clients-in-london How can i exactly do this using .htaccess I've tried something but not working. # redirect "/section.php?id=xxx" to "/section/xxx" RewriteCond %{REQUEST_URI} \s/town\.php\?url=([a-zA-Z0-9_-]+)\s [NC] RewriteRule ^ /town/%1? [R=301,L] # internally rewrite "/section/xxx" to "/section.php?id=xxx" RewriteRule ^oras/([a-zA-Z0-9_-]+)$ /town.php?url=$1 [L]
  7. Hey guys, I am stumped on this htaccess write rule. I currently have this rule functioning: RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /item\.php\?pid=([a-z0-9]+)\ HTTP/ [NC] RewriteRule ^item\.php$ http://www.mysite.com/%1? [R=301,L] RewriteRule ^([-a-z0-9]+)$ /item.php?pid=$1 [NC,L] Original url: http://www.mysite.com/item.php?pid=2015-hyundai-genesis-coupe enabling this url: http://www.mysite.com/2015-hyundai-genesis-coupe What I require is a url like this: http://www.mysite.com/item/2015-hyundai-genesis-coupe I tried a bunch of things with no success. Anyone familiar with this? Thanks!
  8. Here is what I am trying to do. Get from this http://mysite.com/post.php?id=12&title=postname to this http://mysite.com/post/12/postname/ here’s the rewrite rule. Options +FollowSymLinks RewriteEngine On RewriteRule ^post/([a-zA-Z]+)/([0-9]+)/$ post.php?id=$1&title=$2 This is my html link that links to the post.php page. <a href="post.php?id=12&title=postname"> Click here to see the post! </a> It does not change the url. I have also tried it like below and it gives me an internal error. <a href="post/12/postname"> Click here to see the post! </a> Can you see what I have done wrong? Also if the above method for the linking is correct, how do I get the "id" and "title" using the $_GET?
  9. i am trying to understand, how a site like ebay can display content and be case insensitive? for example: The original url: http://www.ebay.co.uk/itm/Toshiba-Satellite-C50-AMD-E-Series-1-4GHz-Dual-Core-15-6-Inch-500GB-2GB-Laptop/151458954958 the above works fine and go to the intended page. user editing the browser url into lowercase : http://www.ebay.co.uk/itm/toshiba-satellite-c50-amd-e-series-1-4ghz-dual-core-15-6-inch-500gb-2GB-laptop/151458954958 random uppercase and lowercase. http://www.ebay.co.uk/itm/toshiba-sateLLite-c50-aMd-e-sERIes-1-4ghz-dual-core-15-6-inch-500gb-2GB-laptop/151458954958 both the urls above also work fine and go to the intended page. How can such a thing can work? it is supposed to throw an error such as page not found and the like? any thoughts welcome.
  10. hello everyone. could you advise me on the structure of my code to check if it is correct: RewriteRule ^/user/([a-z]+)/cake/([a-z\ .*A-Zx0-9-_]+)$ /cakes.php?userid=$1&cakebaked=$2 what i am trying to do is to add a - instead of a whitespace which appears in the url as %20.
  11. I implemented google's reCAPTCHA V2 on http:// on the remote apache shared server and it worked 100%. I then changed the protocol to my shared server SSL using the same PHP script as the non-SSL script. The older version of reCaptcha had an SSL 'false' to 'true' SSL parameter, whereas I can't find one for V2. I had to use htaccess to redirect the example.com to the shared SSL server https://serverid.net/example/ which works perfectly without recCAPTCHA. I incorporated reCAPTCHA V2 and the error message where the reCAPTCHA image should be shows "ERROR: Invalid domain for site key". Here's the htaccess: RewriteEngine On RewriteCond %{HTTP_HOST} ^(.*)example\.com [NC] RewriteCond %{SERVER_PORT} 80 RewriteRule ^(.*)$ https://servername.net/example/$1 [R,L] And the recaptchalib.php code in case that helps: https://github.com/google/ReCAPTCHA/blob/master/php/recaptchalib.php Anyone know how to make this work? (If this is not the right forum for this, please direct me to the appropriate one. Thx)
  12. I think my eyes are going to fall out from all the searches ive made to find a solution for this that works on a shared host. I tried this... but it doesnt work. RewriteEngine on CheckSpelling on The only Rough solution i got is to do the case manually with an internal redirect. Like this. RewriteEngine on RewriteBase /~quux/ RewriteRule ^foo\.html$ bar.html Is there absolutely no way to mention [a-z] and [A-Z] into a RewriteRule to get this done? I find it terribly stupid from Apache not to provide a simple solution for this.
  13. I have create a working site at localhost but when I upload it to webhost, it's not working, all link broken. This is the site. this is the directory : The index.php content is : <?php header('location:home.html'); ?> and the .htaccess content is : RewriteEngine on RewriteRule ^home.html$ main/home.php?main=home [L] RewriteRule ^penyakit.html$ main/home.php?main=penyakit [L] RewriteRule ^review-(.*)\.html$ main/home.php?main=detilgejala&id=$1 [L] RewriteRule ^solusi.html$ main/home.php?main=solusi [L] RewriteRule ^proses$ main/home.php?main=prosessolusi [L] RewriteRule ^bukutamu.html$ main/home.php?main=bukutamu [L] RewriteRule ^send-contact$ main/main_bukutamu/proses_bukutamu.php [L] RewriteRule ^about.html$ main/home.php?main=about [L] RewriteRule ^ensiklopedia.html$ main/home.php?main=ensiklopedia [L] Options All -indexes This config work in localhost. Thanks for your attention and respond, it help me so much and sorry for the topic's title can't edited it.
  14. I need to implement vanity url's on our web site, partly because they look "prettier" but more importantly because Google doesn't seem to like links that end in ".pgm" (many of our pages on our IBM iSeries are written using Websmart ILE and the program suffix is ".pgm"). I am halfway there, I think, but I am not sure if I am doing this right, and I still find taking examples of htaccess redirects and applying them to what I am trying to achieve pretty complicated. All the page links are coded correctly and are going to the right place, but the browser is showing the resulting url, not the link that is clicked on. Hopefully someone can help to steer me in the right direction if I explain what we have... The resulting link needs to be: http://www.mydomain.com/prodpage.pgm?name=750ml Orange Line Marker Spray Paint&item=41912 The vanity link should be: http://www.mydomain.com/product/41912/750ml Orange Line Marker Spray Paint I have this working using the following in .htaccess: RewriteRule product/(.*)/(.*) http://www.mydomain.com/prodpage.pgm?name=$2&item=$1 [L] However... the url that shows in the browser is the resulting link. I need it to be the link that is clicked on. Any thoughts please. I have tried lots of things but nothing seems to give the desired result.
  15. Any one php expert help me, URL imgslink.biz when i upload an image and try to open it, i get error here is my htaccess code RewriteEngine On RewriteCond %{HTTP_REFERER} !^http://(.+\.)?imgslink\.biz/ [NC] RewriteCond %{HTTP_REFERER} !^$ RewriteRule .*\.(jpe?g|gif|bmp|png)$ nohotlink.gif [L] <Files ~ "\.(php|sql|php3|php4|phtml|pl|py|jsp|asp|htm|shtml|sh|cgi)$"> order allow,deny allow from all </Files>
  16. Hi friends, I have to transform this url domain.com/main/folder1/folder2/folder3 to domain.com/get.php?var1=folder1&var2=folder2&var3=folder3 How can i do it with htaccess. Thank u
  17. About a year ago I wrote a mod_rewrite in at sites htaccess file. It was to call a page that queried the database based on a unite code that was assigned to a member. If the member was assigned a code that was FL1001, the URL www.marketingteammates.com/FL1001 would bring up a page that quaried that member and displayed their database content. In the users table of the site, it quaried the field webPageID and the information was called. It called a page webpage.php that quaried the info. The URL in the address bar still displayed www.marketingteammates.com/FL1001. Here are the lines of code in the htaccess file. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([A-Za-z])([A-Za-z])([0-9]+)$ /webpage.php?webPageID=$1$2$3 [NC,L] I now have a second page completely different from the webpage.php. It is a page storeNumber.php and would query a field storeNumberID. This field could contain any kind of string such as Store#101, or mystore101, or #101 is my store. I tried using the same rewite rule just replaceing the webpage.php and variable with storeNumber.php and $storeNumberID. This doesn't work. It also leads me to wonder if there can even be two different pages in the mod_rewrite. How would it diferentiate one from the other. Thanks for any help in advance. Mike
  18. I just started working with my first .htaccess RewriteRule because when submitting a facebook app, it must end with either a trailing slash or be a dynamic URL. My domain already is used for another project so I put my app into a sub-directory so it looks like this http://www.example.com/app/index2.html I'm trying to convert it to be in this format http://www.example.com/app/fbapp/ I can't use app's sub-directory as index.html or index.php which is already used outside of a facebook with Google Ads, since Google Ads are illegal to be used on facebook, I created a copy of the index.html called index2.html without any Google ads on it. I started messing around with .htaccess and I got it semi-working but in Google Chrome it seems to detect the URL as being a folder and starts loading the stylesheets and javascript scripts from the fake virtual directory assuming that fbapp is a directory when it should be app/file.xxx instead of app/fbapp/file.xxx Here is what I got so far I still don't understand how to use Rewrite Condionals but from my understanding if the RewriteCond is triggered it will run the line right under it, otherwise it will skip it somehow and go to the third line which works fine as long as it's not a script/image/stylesheet/etc... RewriteEngine on RewriteCond $1 !^(favicon\.ico|favicon\.png|robots\.txt|css|js) [NC] RewriteRule ^(.*)$ $1 [E=BASE:%1] RewriteRule ^fbapp index2.html [E=BASE:%1]
  19. I have a site which is far from finished, it doesn't have a user registration system yet and has plenty of security holes that need patching. I wanna upload it onto the web so friends can enter data into it, but of course I don't want random people having access to it, and don't want bots attempting to index it. Will adding a .htaccess file with a username/password rule to the root directory keep all bots and humans (which don't have a username/password) out? Side question: if someone logs into the site with a username/password combo that I added to the passwd file (used by the .htaccess file), will I be able to track the user? For example, if someone goes and deletes half the database, will I be able to tell which user it was without having to look through the apache log files? Sorry thats a bad example, lets say I want to make a welcome screen saying "Welcome user3", can I do that with .htaccess system?
  20. Hi, first I'm sorry if I posting this in wrong forum - and sorry for my bad english. I want to make RewriteRules like Twitter - So that the files are displayed as Virtual folders, but if you add the file extensions (.php) he shouldn't view this file! .htaccess edit: AddDefaultCharset UTF-8 Options +FollowSymlinks Options -Indexes Options -ExecCGI <FilesMatch "^\." > deny from all </FilesMatch> RewriteEngine on RewriteBase / RewriteCond %{SERVER_PORT} !=443 RewriteRule ^(.*)$ https://www.abc.com/ [R=301,L] RewriteRule ^profil/$ profil.php?ID=$1 [NC,L] RewriteRule ^([^.]+)/([^.]+)/$ $2.php?ID=1 [NC,L] Can anyone help me?? Best regards Termi
  21. Hello! I have 2 problems with .htaccess . 1) I have a path http://www.myaccount.domain.com/katarina/index.php and I want to remove the folder katarina and to obtain http://www.myaccount.domain.com/index.php How could I solve this problem? 2) I have a path on localhost http://127.0.0.1:8888/katarina/index.php and I want to remove the folder katarina and to obtain http://127.0.0.1:8888/index.php (soI want to remove my folder "katarina") How could I solve this problem? Thank you!
  22. Hi Rewrite rules will not work on cheap hosted godaddy server however rewrite works locally. Can someone le me know whats wrong or the right way please. Working locally but not hosted. RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] #AddType application/x-httpd-php .php5 .php4 .php .php3 .php2 .phtml #AddHandler x-httpd-php5-3 .php RewriteRule ^profile/([a-zA-Z0-9_-]+)/comment/([0-9]+) statusview.php?s=$2&user=$1 RewriteRule ^profile/([a-zA-Z0-9_-]+)/notifications notifications.php?userid=$1 RewriteRule ^profile/([a-zA-Z0-9_-]+) profile.php?id=$1 RewriteRule ^create-account create-account.php RewriteRule ^forgot-password forgot-password.php RewriteRule ^about about.php RewriteRule ^privacy privacy.php RewriteRule ^terms-of-service terms-of-service.php RewriteRule ^contact contact.php RewriteRule ^login login.php RewriteRule ^([a-z_-]+)/([a-z0-9_-]+)/([0-9]+) comment.php?subcat=$3 RewriteRule ^category/([a-zA-Z_-]+) category.php?cat=$1 RewriteRule ^how-it-works how-it-works.php RewriteRule ^updates updates.php Link http://www.example.com/profile/john does not work have to use http://www.example.com/profile.php?id=john to test.
  23. Hello, I have this rule in htaccess file that handles URL for item, Options All RewriteEngine On RewriteBase /www/ RewriteCond %{THE_REQUEST} \ /www/item\.php\?id=([0-9]+)&([^&\ ]+) RewriteRule ^ %1/%2? [L,R=301] RewriteRule ^([0-9]+)/(.*)$ item.php?id=$1&$2 [L,QSA,NE] in same htaccess I need to handle catlist also with this rule: RewriteCond %{THE_REQUEST} \ /www/category\.php\?id=([0-9]+)&([^&\ ]+) RewriteRule ^ %1/%2? [L,R=301] RewriteRule ^([0-9]+)/(.*)$ category.php?id=$1&$2 [L,QSA,NE] When I put them together only first one works Any solutions or ideas Thank You
  24. I've been trying for hours to rewrite my current url: domain.com/post.php?id=7 ...and make it appear like this: domain.com/this-is-my-title I haven't been able to do it yet. All the online examples show using an id first or something, but I really like just .com/title only. So.. can I do that? I've seen other sites achieve it, such as upworthy, so I know it's possible. Part II: How would I call the new page from index.php? I have a database table called 'article' and the column I need is 'title' and there's obviously a postid for each entry.. I can manage to use php enough to put a dash in between all the words of the title and remove all special characters but... Not sure how to make the call though. I mean... I see that $theArticle['title'] returns the title in my current code, but displaying the url only? Is what I'm trying possible? Thanks for any suggestions!
  25. Can anyone please provide me a example and explanation of URL rewriting with PHP only. I already tested using .htaccess and it works fine. What I want to achieve is to rewrite a URL without using a .htaccess. I read some blogs but still can't understand a bit.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.