mod rewrite not working - mod-rewrite

I have a site where my pages are generated dynamically. I want to change the url from:
http://www.mydomain.com/library.php?id=13
to something like:
http://www.mydomain.com/13.html
I am using this Rewrite Rule:
RewriteEngine On
RewriteRule ^([^/]*)\.html$ /library.php?id=$1 [L]
Unfortunately it doesn't work. When I click on the link the page goes to this url:
www.mydomain.com/library.php?id=13
But the strange part is when I browse to www.mydomain.com/13.html the link is working.
What am I missing?

You need to change the links that are generated in the library.php files to your new defined format :)

Related

How to setup URL redirect in Cyberpanel (Lightshot)

I am trying to rewrite URLS in my website but unable to do so.
I am using Lightspeed in Cyberpanel. The .htaccess code I used is:
RewriteRule ^([^/d]+)/?$ index.php?id=$1 [QSA]
What my url looks right now: mysite.tld/index.php?a=2322
What I want to look it like: mysite.tld/2322
Thanks in advance!

Single page mod rewriting for SEO

I have a page as follows.
www.mysite.com/about.php
I want this to be set in the htaccess file so that it looks like below.
www.mysite.com/my-keyword-here
Please help me.
Thanks in advance.
Sam
Add this to the htaccess file in your document root:
RewriteEngine On
RewriteRule ^/?my-keyword-here$ /about.php [L]
So now if you enter http://www.mysite.com/my-keyword-here in your browser's URL address bar, you will be returned the content of /about.php.

Code Igniter URL routing confusion

I have a slight issue. I have configured my default controller as :
c$route['default_controller'] = 'news';
so when I point my browser to http://localhost/mysite all the news get loaded as instructed by the news controller.
Now on this page, I have given links to "read article" to read the full article. For this I have to point my browser to http://localhost/index.php/news/view/news-slug. I want to remove index.php from the url. I had already tried re-routing using wildcard without any success. Can you tell me how to do that?
There is a documentation on removing the index.php from the URL if you are using Apache with it's mod_rewrite:
Removing the index.php file
Using the following rewrite code:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
Also, there are many similar questions to yours, have a look at these questions from the search:
Search query on removing index.php in Codeigniter
You need to define your .htaccess file for this. Check this wiki: http://codeigniter.com/wiki/mod_rewrite

iirf rewrite url

i'm trying to use iirf for what looks like asimple rewrite but it's not working.
what i need:
rewrite http://www.mydomain.com/ru to : http://www.mydomain.com?page=russian
the objective being that a get param would be sent but the user would see the first url on their browser's url bar.
i'm using the following code:
RewriteEngine ON
StatusUrl /iirfStatus
RewriteRule http://www.mydomain.com/ru http://www.mydomain.com?page=russian
does this go (the iirf file) on the site's root or in a 'ru' subfolder (tried both)?
what am i doing wrong or missing?
thanx and have a nice day :-)
The following should work:
RewriteRule ^/ru$ /?page=russian [I,L]
You should put this in the iirf.ini file in the web sites root folder.
Check http://www.mydomain.com/iirfStatus to see whether iirf was able to read your configuration file.
Also, you may use RewriteLogLevel with a value of 2 or 3 and RewriteLog to see whether the incoming url was rewritten, and how (or why not).

How to avoid ruining TinyMCE popups with url rewriting?

I have a website which uses TinyMCE textboxes for editing. It works fine except for the toolbar options which open a popup window as it seems to be caught by my url rewriting in the .htaccess file. Each of them show my 404-page. The url rewriting is set up so that all urls (except ajax calls) are sent to an index.php file. It seems obvious that the popup windows are caught by this as well but I have no idea what url signatrues to look for in the .htaccess file, so do anyone know what kind of pattern I can match against?
As #andyk pointed out, you can use a .htaccess in your TinyMCE folder to override the global settings that are doing the URL rewriting. I've done this in the past myself to resolve the same issue.
If that's not attractive to you for whatever reason, the other option is to exclude the tinyMCE folder like so:
# if URL starts with /TinyMCE, stop processing here
RewriteCond %{REQUEST_URI} ^/TinyMCE [NC]
RewriteRule .* - [L]
This sets a rewrite condition to check for the directory TinyMCE is in, and if found, the rule .* - means for all URLS, do nothing and the [L] means stop processing here.
try putting an exception in your htaccess for the tinyMCE folder maybe ?

Resources