Jump to content

Search the Community

Showing results for tags 'rewrite'.

  • 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

Found 13 results

  1. I've got a URL http://sub.domain.com/index.php?aggrement I am having a problem trying to change this to through IIS rewrite http://sub.domain.com/index.php/aggrement or http://sub.domain.com/aggrement and another question throught chaging.. is this can be rewrite without redirecting and load the controller directly " aggrement controller" I'm using codeigniter 3 as php framework. Thank you
  2. 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.
  3. Hello I have problem on redirecting the site to https when it comes to "www.site.com". I made this <rules> <rule name="Redirect site.com to www" patternSyntax="Wildcard" stopProcessing="true"> <match url="*" /> <conditions> <add input="{HTTP_HOST}" pattern="site.co" /> </conditions> <action type="Redirect" url="https://www.site.co/{R:0}" /> </rule> </rules> In this sample when I try to access the site through "site.com" it redirect to " https://www.site.com " but when I access the site to www.site.com the https doesn't appear.
  4. 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]
  5. 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.
  6. Hi everyone, I have the following .HTACCESS which is used for my PHP files. However I want to keep all the following information (see second .HTACCESS) but change the address of my wordpress files from http://www.mysite.com/wordpress to http://www.mysite.com/ If I follow the tutorial and add the following to my .HTACCESS it works... # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /newformat/ RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /wordpress/index.php [L] </IfModule> # END WordPress ... However none of my other rewrites work... any ideas? My original .HTACCESS file is below; RewriteEngine on # defeat robot exploits RewriteCond %{QUERY_STRING} http:// [OR] RewriteCond %{REQUEST_URI} http:// RewriteRule ^(.*)$ - [F] rewritecond %{http_host} ^mysite.com [nc] rewriterule ^(.*)$ http://www.mysite.com/$1 [r=301,nc] # disable directory browsing Options All -Indexes RewriteRule ^furniture(.*).html$ furnituredisplay.php?page=furniture/furniture$1&type=htm [L,NC] RewriteRule ^android(.*).html$ androiddisplay.php?page=android/android$1&type=htm [L,NC] #php_flag register_globals on #php_flag display_errors off Any ideas how to merge? If possible? cheers, Andrew
  7. Hey guys, I'm in the process of creating a website and Im currently adding a blog. I have the htaccess working so far, but I dont know how to add another condition for the blog and htaccess is really tricky for me... regardless, this is current htaccess: <IfModule mod_rewrite.c> Options +FollowSymlinks RewriteEngine On </IfModule> # If requested resource exists as a file or directory, skip next two rules RewriteCond %{DOCUMENT_ROOT}/$1 -f [OR] RewriteCond %{DOCUMENT_ROOT}/$1 -d RewriteRule (.*) - [s=2] # Remove the .php extension RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] #RewriteCond %{REQUEST_FILENAME} !-f #RewriteCond %{REQUEST_FILENAME} !-d #RewriteRule ^(.*)$ index.php?page=$1 [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ app.php?tag=$1 [QSA,L] # ---------------------------------------------------------------------- # Custom 404 page # ---------------------------------------------------------------------- # You can add custom pages to handle 500 or 403 pretty easily, if you like. ErrorDocument 403 /error.php?type=403 ErrorDocument 404 /error.php?type=404 ErrorDocument 500 /error.php?type=500 This works, though I have no idea if its in any way correct. What I need is a normal vanity url thing which would rewrite /blog/some-blog-title-here/1 to /blog.php?title=some-blog-title&id=1 but obviously the user would see the first option. Any help or suggestions?
  8. I am trying to create a rewrite rule that will let me keep the following URL clean: <script type="text/javascript" src="http://www.mysite.com/views/Page/js/jsfile1.js"></script> To be: <script type="text/javascript" src="http://www.mysite.com/js/jsfile1.js"></script> When I want to include JS and CSS files in any given view, I call: $this->view->js = array('Page/js/jsfile1.js', 'Page/js/jsfile2.js') ; Where Page would change according to the controller you are currently in. E.g. If I am on www.mysite.com/contact, any JS I load be redirected to: www.mysite.com/views/contact/js/jsfile1.js But in the header of my contact page you would only see: <script type="text/javascript" src="http://www.mysite.com/js/jsfile1.js"></script> How can this be done? Or does someone know of a better way to not expose the system directories such as /views etc in a PHP MVC framework (this is my own mini custom framework BTW)? I hope I'm making sense!
  9. Hello PHPFreaks Been a long time since i've been here last time! (hopefully it means that i'm getting better However! I'm playing around with "new" technology the mod_rewrite for the .htaccess file. I'm writting a php app where the url has 2 parameters. example.com?path=this/is/a/path/to/this/&slug=page NOW my dilemma is that my .htaccess rules work IF there is NO / (slash) in the ?path= var (since I separate the 2 vars at a /). my question is now! (bear in mind here that i'm a ROOKIE at .htaccess rewriting) how do i go about in the .htaccess file to make it reconize that whatever comes after the last slash the $2 variable and everything is $1 - even if there is no $path defined in the url? BTW! I'm not looking for free handouts and do my coding here! I'm willing to learn here but just need pointers!! I've pasted my .htaccess file here: Options +FollowSymlinks RewriteEngine On RewriteCond %{REQUEST_URI} !=/index.php RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)/([^/.]+)$ /index.php?slug=$1&type=$2&view=$3&action=$4 [L,PT] RewriteRule ^([^/.]+)/([^/.]+)/([^/.]+)$ /index.php?slug=$1&type=$2&view=$3 [L,PT] RewriteRule ^([^/.]+)/([^/.]+)$ /index.php?path=$1&slug=$2 [L,PT] RewriteRule ^([^/.]+)$ /index.php?slug=$1 [L,PT] RewriteRule ^(.+)/$ /$1 [R=301,L] Thanks in advance
  10. In the below function I am trying to understand the $new_rules array. I understand it is matching a pattern an then rewriting that pattern to a friendly url. But I just don't understand the logic of what portion is capturing the pattern and what portion is telling it to rewrite in another format and what that format is. Could someone help me understand each section of the $new_array in basic terms so I can understand the logic of the matching and rewrite? I am trying to learn this but just can seem to get it. In this example cardealers is my custom post type, and brands and state are a taxonomy. Thank you! function eg_add_rewrite_rules() { global $wp_rewrite;[/font][/color] $new_rules = array( 'cardealers/(brands|state)/(.+?)/(brands|state)/(.+?)/?$' => 'index.php?post_type=cardealers&' . $wp_rewrite->preg_index(1) . '=' . $wp_rewrite->preg_index(2) . '&' . $wp_rewrite->preg_index(3) . '=' . $wp_rewrite->preg_index(4), 'cardealers/(brands|state)/(.+)/?$' => 'index.php?post_type=cardealers&' . $wp_rewrite->preg_index(1) . '=' . $wp_rewrite->preg_index(2) ); $wp_rewrite->rules = $new_rules + $wp_rewrite->rules; add_action( 'generate_rewrite_rules', 'eg_add_rewrite_rules' );
  11. Hello everybody, This is one of my first times that i need to configure a .htacces file, so maybe is this a very simple question but I cant figure it out by myself . Situation: I have a local site, that reachable under the URL: "framework.dev". But I need to configure a rewrite rule: rewrite all the URL's to index.php, except the exact URL: 'framework.dev'. example: framework.dev/users //Rewrite this url to index.php framework.dev/users/edit/1 //Rewrite this url to index.php framework.dev/login //Rewrite this url to index.php etc.. framework.dev //Do not rewrite How do i formulate the correct .htacces rewrite rule? Thank you for you time, Greetings Jelte PS: I you know a good .htaccess tutorial please inform me
  12. Okay, so I have a website. My images are stored in /images. When someone links to an image on my site from somewhere on the web, I want them to be redirected to a file (image.php) that handles redirecting them to a page that shows the image. This way any user linking to one of my images ends up linking the user to my page that contains that image. My problem is that when I implement the following line in my htaccess, internal images - that is to say anchors on all of my pages break. Is there a way to check if a user is on, say index.php and allow images to be linked to, but if a user is just plain trying to view that image without being inside any other file, to make the redirect happen? RewriteRule ^images/([^\s]+(\.(?i)(jpg|png|gif|bmp))$)$ image.php?id=$1 [R=301,NC,L] I have tried everything I've seen online and am out of ideas. There is really only one file that DOES need the image anchors, so I wouldn't be terribly disappointed if the code was just a manual whitelist of files or something of that sort. Thanks in advance!
  13. Okay, so I have a file named tagging.php that links to itself. Sometimes, it needs to pass itself an ID. I wanted a URL like: website/tagging/8 instead of: website/tagging.php?id=8 I'm not sure what's wrong with my rewrite rule: RewriteRule ^tagging/([0-9]+)$ tagging.php?id=41 [NC, L] Any ideas?
×
×
  • 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.