Jump to content

URL Setting


crypticscs

Recommended Posts

I made a website in PHP mvc framework. Now I want to remove "public" keyword from URL. I tried by removing  require "../app/init.php";  these dots and bringing htaccess & index.php file in root directory. But it doesn't work. I searched on google but didn't find anything. Here is my index page code:

 

Quote

<?php 
session_start();

require "../app/init.php";

$app = new App();

 

and my htaccess code:

 

Quote

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

Please give me a solution to it. Thank you

Link to comment
Share on other sites

Not sure what is not working since you don't say what error you are getting. .htaccess is managed by httpd and has nothing to do with PHP or "bringing it in." It appears to me like 2 different problems. Let's start with problem one. What URL do you want to rewrite and what do you want the rewritten URL to be?

Link to comment
Share on other sites

6 hours ago, crypticscs said:

Now I want to remove "public" keyword from URL.

Are you saying that all your URLs are like https://whatever.example.com/public/filename.php? Is that because you have an actual public/ directory for your files? If so then it sounds like you need to tell Apache that your website should have its document root in that very same public/ directory...

  • Like 1
Link to comment
Share on other sites

16 hours ago, requinix said:

Are you saying that all your URLs are like https://whatever.example.com/public/filename.php? Is that because you have an actual public/ directory for your files? If so then it sounds like you need to tell Apache that your website should have its document root in that very same public/ directory...

Yes. I just want my URL like https://whatever.example.com. I tried to do so by putting index and htaccess file in root directory but it is not working. I tried to get a solution but I didn't get any. 

Link to comment
Share on other sites

4 hours ago, crypticscs said:

Yes. I just want my URL like https://whatever.example.com. I tried to do so by putting index and htaccess file in root directory but it is not working. I tried to get a solution but I didn't get any. 

Did you read the part of my post that said what it is you need to do? Not by moving files but by changing the Apache configuration. The key words in there were "document root".

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.