segment based url not working codeigniter - url

at this site:
http://www.syriadailynews.com/sdn/
I used codeigniter with segment based url
and it works fine at localhost (xampp)
but after uploded the site, all urls not working
this is my .htaccess
Options +FollowSymLinks
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
AddDefaultCharset UTF-8

I edit config.php to this:
$config['index_page'] = 'index.php';
$config['uri_protocol'] = 'AUTO';
It's worked now ! ^_^

Related

Change url estructure htacesss

I've been trying for days to generate a file that modifies the url structure.
I have a current url like this
http://localhost/stores/leo
and I need it to stay like this
https://leo.localhost
Use PHP Server XAMP and Larabel
the word "leo" is generated according to the product and it will always change.
How could you generate it?
Thanks!
I have this code that works but the URL changes in the address bar and does not stay with the desired URL.
RewriteEngine On
RewriteBase /
#force https and non-www
RewriteCond %{HTTP_HOST} ^(www\.)(.+) [OR]
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^(www\.)?(.+)
RewriteRule ^ https://%2%{REQUEST_URI} [R=301,L]
# profile redirection
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{HTTP_HOST} ^(.*)\.localhost [NC]
RewriteRule (.*) https://localhost/stores/%1/$1 [L]

URL rewrite rule is not working

My url is http://example.com/index.php?pid=software_details&p=18 I want to change my url to http://example.com/software_details/18. I used .htaccess file to do this but it's not working... please someone help me! thanks in advance...!
My .htaccess code is as bellow:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^/([^/]*)/([^/]*) /index.php?pid=$1&p=$2 [L]
</IfModule>
I think the rule below should achieve what you are looking for:
RewriteRule ^/(.*)/(.*)$ /index.php?pid=$1&p=$2 [R=301,L]

URL Rewrite a Query String

I have Google'ed long for this but can't find an answer.
I have this URL:
www.mysite.com/index.php?tip=1
(respectively www.mysite.com/?tip=1)
And want it to rewrite to:
www.mysite.com/tip/1
Your help would be appreciated.
You will need to enable rewrite module in your apache config and put the following settings on the .htaccess file your base folder
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^tip/(.*) /index.php?tip=$1 [L,NC,QSA]

301 Redirect specific page with ModX Evo

I have this in my .htaccess file:
# For Friendly URLs
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
I want to redirect the url /sale to the new one /gift-sales So I have added this to the above:
RewriteCond %(THE-REQUEST)^sale$
RewriteRule ^(.*)$ /gift-sales [R=30,L]
In the ModX backend I have, of course, changed the alias to gift-sales, but I cannot seem to get the redirect working. Can anyone point me in the right direction?
try this:
RewriteRule ^/sale http://www.mydomain.com/gift-sales [R=301,L]

mod_rewrite redirect non-numeric IDs only when a directory isn't found?

I'm using mod_rewrite to redirect on URLs like: mysite.com/123
RewriteEngine On
RewriteRule ^([0-9]+)$ /n/index.php?id=$1 [L]
This works only for numeric IDs.
How do I make it work for non-numeric IDs while I preventing the redirect from happening when a subdirectory is found?
Change the rewrite rules to this: This should work for both numeric as well as non-numeric IDs preventing the redirect from happening when a subdirectory is found.
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^([\w\d]+)$ /n/index.php?id=$1 [L]

Resources