How to setup URL redirect in Cyberpanel (Lightshot) - mod-rewrite

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!

Related

url rewriting and redirection using .htaccess

I have been trying to rewrite dynamically generated URLs to static URLs. For example I achieve this URL after implementation of .htaccess command:
Rewritten URL: http://www.risenotes.com/top/Love-best-quotes
while actual URL is: http://www.risenotes.com/quotes/great-best-quotations.php?topic=Love
I am using below command for this purpose:
RewriteEngine On
RewriteRule ^top/([^/]*)-best-quotes$ /quotes/great-best-quotations.php?topic=$1 [L]
My code works perfectly well for above but I want to redirect all requests for
/quotes/great-best-quotations.php?topic=Love
to newly rewritten URL
/top/Love-best-quotes.
Can anyone guide me please???

Rewrite URL's in Joomla menus

My group and I are working on a school project with Joomla. We have custom php to list "articles" from our database, and the PHP is getting its data from $_GET (from the url.)
Skip to the question:
This is what we have:
example.com/articles/menu
We want:
example.com/articles/menu?q=something+something
How do you rewrite / add text to url, so we get that format?
We are using the school server, so we have no admin-rights on the server.
I have tried mod_rewrite rules in .htaccess, but without success.
The server is running windows.
We are using joomla 2.5
RewriteEngine On
RewriteRule ^index.php/articles/menu?q=something+something$ /index.php/articles/menu [L]
Try this:
RewriteEngine On
RewriteRule ^/articles/menu$ index.php/articles/menu?q=something+something [QSA,L]
And that will do the job.
Hey by the way, try to google a bit, there are tons of answers for such simple things ;)
Checkout the right documentation about QSA directive: http://httpd.apache.org/docs/current/rewrite/flags.html#flag_qsa

mod rewrite add url param

I'm working on an integration with Yiiframework and Joomla. I have it working for the most part, but want to make it a little cleaner. The URL that is called in Joomla needs to get some URL Parameters appended to the URL. I have setup the .htaccess to rewrite the URL, but it's not working and I can't figure out why. Please help.
What the URL current is:
/index.php?r=site/index
What I want it to append is "option=com_jumi&fileid=3" so it looks like this
/index.php?r=site/index&option=com_jumi&fileid=3
Here is what I have for the rewrite
RewriteCond %{QUERY_STRING} ^r=(.*)$ [NC]
RewriteRule ^/index.php$ /index.php?r=%1&option=com_jumi&fileid=3 [NC,L,R=301]
Looking for some guidance, thanks

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

mod rewrite not working

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 :)

Resources